Skip to content

Commit 5bac9d6

Browse files
committed
title screen updates
1 parent b3eefda commit 5bac9d6

File tree

11 files changed

+280
-15
lines changed

11 files changed

+280
-15
lines changed

assets/fonts/arrancar.ttf

38 KB
Binary file not shown.

assets/fonts/guavine.otf

9.27 KB
Binary file not shown.

assets/images/credits-button.png

23.6 KB
Loading

assets/images/gear.png

589 KB
Loading

assets/images/start-button.png

20.6 KB
Loading

assets/images/title-background.png

77.9 KB
Loading

assets/images/title-hand.png

65.5 KB
Loading

src/game/assets.rs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,30 @@ pub(super) fn plugin(app: &mut App) {
1313

1414
app.register_type::<HandleMap<SoundtrackKey>>();
1515
app.init_resource::<HandleMap<SoundtrackKey>>();
16+
17+
app.register_type::<HandleMap<FontKey>>();
18+
app.init_resource::<HandleMap<FontKey>>();
19+
}
20+
21+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Reflect)]
22+
pub enum FontKey {
23+
Arrancar,
24+
Guavine,
25+
}
26+
27+
impl AssetKey for FontKey {
28+
type Asset = Font;
29+
}
30+
31+
impl FromWorld for HandleMap<FontKey> {
32+
fn from_world(world: &mut World) -> Self {
33+
let asset_server = world.resource::<AssetServer>();
34+
[
35+
(FontKey::Arrancar, asset_server.load("fonts/arrancar.ttf")),
36+
(FontKey::Guavine, asset_server.load("fonts/guavine.otf")),
37+
]
38+
.into()
39+
}
1640
}
1741

1842
#[derive(Copy, Clone, Eq, PartialEq, Hash, Reflect)]
@@ -41,6 +65,11 @@ pub enum ImageKey {
4165
ClockTable,
4266
OilTable,
4367
Background,
68+
TitleBackground,
69+
Gear,
70+
TitleHand,
71+
StartButton,
72+
CreditsButton,
4473
}
4574

4675
impl AssetKey for ImageKey {
@@ -258,6 +287,51 @@ impl FromWorld for HandleMap<ImageKey> {
258287
},
259288
),
260289
),
290+
(
291+
ImageKey::TitleBackground,
292+
asset_server.load_with_settings(
293+
"images/title-background.png",
294+
|settings: &mut ImageLoaderSettings| {
295+
settings.sampler = ImageSampler::nearest();
296+
},
297+
),
298+
),
299+
(
300+
ImageKey::Gear,
301+
asset_server.load_with_settings(
302+
"images/gear.png",
303+
|settings: &mut ImageLoaderSettings| {
304+
settings.sampler = ImageSampler::nearest();
305+
},
306+
),
307+
),
308+
(
309+
ImageKey::TitleHand,
310+
asset_server.load_with_settings(
311+
"images/title-hand.png",
312+
|settings: &mut ImageLoaderSettings| {
313+
settings.sampler = ImageSampler::nearest();
314+
},
315+
),
316+
),
317+
(
318+
ImageKey::StartButton,
319+
asset_server.load_with_settings(
320+
"images/start-button.png",
321+
|settings: &mut ImageLoaderSettings| {
322+
settings.sampler = ImageSampler::nearest();
323+
},
324+
),
325+
),
326+
(
327+
ImageKey::CreditsButton,
328+
asset_server.load_with_settings(
329+
"images/credits-button.png",
330+
|settings: &mut ImageLoaderSettings| {
331+
settings.sampler = ImageSampler::nearest();
332+
},
333+
),
334+
),
261335
]
262336
.into()
263337
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Plugin for AppPlugin {
4747
})
4848
.set(AudioPlugin {
4949
global_volume: GlobalVolume {
50-
volume: Volume::new(0.5),
50+
volume: Volume::new(0.4),
5151
},
5252
..default()
5353
}),

src/screen/loading.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bevy::prelude::*;
55

66
use super::Screen;
77
use crate::{
8-
game::assets::{HandleMap, ImageKey, SfxKey, SoundtrackKey},
8+
game::assets::{FontKey, HandleMap, ImageKey, SfxKey, SoundtrackKey},
99
ui::prelude::*,
1010
};
1111

@@ -31,10 +31,12 @@ fn all_assets_loaded(
3131
image_handles: Res<HandleMap<ImageKey>>,
3232
sfx_handles: Res<HandleMap<SfxKey>>,
3333
soundtrack_handles: Res<HandleMap<SoundtrackKey>>,
34+
font_handles: Res<HandleMap<FontKey>>,
3435
) -> bool {
3536
image_handles.all_loaded(&asset_server)
3637
&& sfx_handles.all_loaded(&asset_server)
3738
&& soundtrack_handles.all_loaded(&asset_server)
39+
&& font_handles.all_loaded(&asset_server)
3840
}
3941

4042
fn continue_to_title(mut next_screen: ResMut<NextState<Screen>>) {

0 commit comments

Comments
 (0)