Skip to content

Commit

Permalink
add new menu translations and buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
thombruce committed Nov 6, 2023
1 parent d6a2bcc commit bf6966f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 72 deletions.
6 changes: 4 additions & 2 deletions assets/locales/de/de-DE/start_menu.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
press-start = Drücke Start
credits-prompt = Drücken Sie „C“ für Credits
new-game = Neues Spiel
settings = Einstellungen
credits = Credits
quit = Aufhören
6 changes: 4 additions & 2 deletions assets/locales/en/en-US/start_menu.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
press-start = Press Start
credits-prompt = Press 'C' for Credits
new-game = New Game
settings = Settings
credits = Credits
quit = Quit
6 changes: 4 additions & 2 deletions assets/locales/ru/ru-RU/start_menu.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
press-start = нажмите старт
credits-prompt = Нажмите «C», чтобы получить кредиты
new-game = Новая игра
settings = Настройки
credits = Кредиты
quit = Покидать
96 changes: 30 additions & 66 deletions src/ui/menus/start_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ use fluent_content::Content;
use leafwing_input_manager::prelude::{ActionState, InputManagerPlugin};

use crate::{
core::{
effects::blink::DrawBlinkTimer,
resources::assets::{AudioAssets, UiAssets},
},
core::resources::assets::{AudioAssets, UiAssets},
i18n::I18n,
inputs::menu::{menu_input_map, MenuAction},
systems::states::{ForState, GameState},
Expand Down Expand Up @@ -71,77 +68,44 @@ pub(crate) fn spawn_start_menu(mut commands: Commands, ui: Res<UiAssets>, i18n:
style: Style {
width: Val::Px(350.0),
height: Val::Px(169.4),
margin: UiRect::bottom(Val::Px(25.)),
..default()
},
..default()
},
Name::new("Title"),
));
parent.spawn((
TextBundle {
style: Style {
margin: UiRect::top(Val::Px(50.)),
..default()
},
text: Text::from_section(
i18n.content("press-start").unwrap().to_ascii_uppercase(),
TextStyle {
font: ui.font.clone(),
font_size: 35.0,
color: Color::rgb_u8(0x00, 0x88, 0x88),
},
),
..default()
},
DrawBlinkTimer(Timer::from_seconds(0.65, TimerMode::Repeating)),
));
});

commands
.spawn((
NodeBundle {
style: Style {
position_type: PositionType::Absolute,
width: Val::Percent(100.0),
height: Val::Percent(100.0),
align_items: AlignItems::FlexEnd,
justify_content: JustifyContent::FlexEnd,
flex_direction: FlexDirection::Row,
..default()
},
..default()
},
ForState {
states: vec![GameState::StartMenu],
},
Name::new("Hint"),
))
.with_children(|parent| {
parent.spawn((
TextBundle {
style: Style {
justify_content: JustifyContent::FlexEnd,
margin: UiRect {
left: Val::Px(10.0),
right: Val::Px(10.0),
top: Val::Px(10.0),
bottom: Val::Px(10.0),
},
..default()
},
text: Text::from_section(
i18n.content("credits-prompt").unwrap(),
TextStyle {
font: ui.font.clone(),
font_size: 25.0,
color: Color::rgb_u8(0xAA, 0xAA, 0x33),
for string in ["new-game", "settings", "credits", "quit"] {
parent
.spawn(ButtonBundle {
style: Style {
margin: UiRect::top(Val::Px(25.)),
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
},
),
..default()
},
Name::new("Hint Text"),
));
background_color: BackgroundColor(Color::Rgba {
red: 0.,
green: 0.,
blue: 0.,
alpha: 0.,
}),
..default()
})
.with_children(|parent| {
parent.spawn(
TextBundle::from_section(
i18n.content(string).unwrap().to_ascii_uppercase(),
TextStyle {
font: ui.font.clone(),
font_size: 25.0,
color: Color::rgb_u8(0x00, 0x88, 0x88),
},
), // DrawBlinkTimer(Timer::from_seconds(0.65, TimerMode::Repeating)),
);
});
}
});
}

Expand Down

0 comments on commit bf6966f

Please sign in to comment.