Merge pull request #69 from Ewpratten/level-select-title
fix level select title
This commit is contained in:
commit
dd16a0debc
@ -26,6 +26,7 @@ pub struct LevelSelectScreen {
|
|||||||
is_btm_pressed: bool,
|
is_btm_pressed: bool,
|
||||||
selected_level: Option<usize>,
|
selected_level: Option<usize>,
|
||||||
visible_levels: usize,
|
visible_levels: usize,
|
||||||
|
counter: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LevelSelectScreen {
|
impl LevelSelectScreen {
|
||||||
@ -35,6 +36,7 @@ impl LevelSelectScreen {
|
|||||||
is_btm_pressed: false,
|
is_btm_pressed: false,
|
||||||
selected_level: None,
|
selected_level: None,
|
||||||
visible_levels: 0,
|
visible_levels: 0,
|
||||||
|
counter: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,6 +75,8 @@ impl Action<Scenes, ScreenError, GameContext> for LevelSelectScreen {
|
|||||||
trace!("execute() called on LevelSelectScreen");
|
trace!("execute() called on LevelSelectScreen");
|
||||||
self.render_screen_space(&mut context.renderer.borrow_mut(), &context.config);
|
self.render_screen_space(&mut context.renderer.borrow_mut(), &context.config);
|
||||||
|
|
||||||
|
self.counter += 1;
|
||||||
|
|
||||||
if let Some(level) = self.selected_level {
|
if let Some(level) = self.selected_level {
|
||||||
// Play the sound
|
// Play the sound
|
||||||
context
|
context
|
||||||
@ -110,6 +114,7 @@ impl Action<Scenes, ScreenError, GameContext> for LevelSelectScreen {
|
|||||||
debug!("Finished LevelSelectScreen");
|
debug!("Finished LevelSelectScreen");
|
||||||
self.selected_level = None;
|
self.selected_level = None;
|
||||||
self.is_btm_pressed = false;
|
self.is_btm_pressed = false;
|
||||||
|
self.counter = 0;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,13 +145,28 @@ impl ScreenSpaceRender for LevelSelectScreen {
|
|||||||
let mouse_pressed: bool = raylib.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON);
|
let mouse_pressed: bool = raylib.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON);
|
||||||
|
|
||||||
//Render the title
|
//Render the title
|
||||||
raylib.draw_rgb_split_text(
|
let timer: i32 = get_random_value(50, 400);
|
||||||
Vector2::new(40.0, 80.0),
|
if self.counter > timer {
|
||||||
"Level Select",
|
raylib.draw_rgb_split_text(
|
||||||
70,
|
Vector2::new(40.0, 80.0),
|
||||||
true,
|
"[Level Select]",
|
||||||
Color::WHITE,
|
70,
|
||||||
);
|
true,
|
||||||
|
Color::WHITE,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if self.counter > timer + 20 {
|
||||||
|
self.counter = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
raylib.draw_rgb_split_text(
|
||||||
|
Vector2::new(40.0, 80.0),
|
||||||
|
"[Level Select]",
|
||||||
|
70,
|
||||||
|
false,
|
||||||
|
Color::WHITE,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Render the levels
|
// Render the levels
|
||||||
for level in 0..self.visible_levels {
|
for level in 0..self.visible_levels {
|
||||||
|
Reference in New Issue
Block a user