mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-22 13:42:47 +00:00
Menu titles (#115)
This commit is contained in:
parent
adfc768a8f
commit
90900f01e1
|
@ -352,7 +352,7 @@ impl Scene for TitleScene {
|
|||
fn draw(&self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
||||
self.background.draw(state, ctx, &self.frame, &self.textures, &self.stage)?;
|
||||
|
||||
if self.current_menu != CurrentMenu::SaveSelectMenu {
|
||||
if self.current_menu == CurrentMenu::MainMenu {
|
||||
let batch = state.texture_set.get_or_load_batch(ctx, &state.constants, "Title")?;
|
||||
batch.add_rect(
|
||||
((state.canvas_size.0 - state.constants.title.logo_rect.width() as f32) / 2.0).floor(),
|
||||
|
@ -361,6 +361,23 @@ impl Scene for TitleScene {
|
|||
);
|
||||
|
||||
batch.draw(ctx)?;
|
||||
} else {
|
||||
let window_title = match self.current_menu {
|
||||
CurrentMenu::ChallengesMenu => (state.t("menus.main_menu.challenges")),
|
||||
CurrentMenu::ChallengeConfirmMenu | CurrentMenu::SaveSelectMenu => (state.t("menus.main_menu.start")),
|
||||
CurrentMenu::OptionMenu => (state.t("menus.main_menu.options")),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
state.font.draw_colored_text_with_shadow_scaled(
|
||||
window_title.chars(),
|
||||
state.canvas_size.0 / 2.0 - state.font.text_width(window_title.chars(), &state.constants) / 2.0,
|
||||
state.font.line_height(&state.constants), //im sure there is a better way to shift this into place
|
||||
1.0,
|
||||
(0xff, 0xff, 0xff, 0xff),
|
||||
&state.constants,
|
||||
&mut state.texture_set,
|
||||
ctx,
|
||||
)?;
|
||||
}
|
||||
|
||||
self.draw_text_centered(&VERSION_BANNER, state.canvas_size.1 - 15.0, state, ctx)?;
|
||||
|
|
Loading…
Reference in a new issue