diff --git a/game/game_logic/src/scenes/main_menu.rs b/game/game_logic/src/scenes/main_menu.rs index 9131c79a..7c7d1825 100644 --- a/game/game_logic/src/scenes/main_menu.rs +++ b/game/game_logic/src/scenes/main_menu.rs @@ -67,13 +67,11 @@ impl MainMenu { draw.clear_background(Color::WHITE); //I wanna see where mouseeee - unsafe { - let mut mouseX = GetMouseX(); - let mut mouseY = GetMouseY(); - - draw.draw_text((&mouseX.to_string()), 20, 5, 20, Color::BLACK); - draw.draw_text((&mouseY.to_string()), 70, 5, 20, Color::BLACK); - } + let mouse_x = draw.get_mouse_x(); + let mouse_y = draw.get_mouse_y(); + + draw.draw_text(&mouse_x.to_string(), 20, 5, 20, Color::BLACK); + draw.draw_text(&mouse_y.to_string(), 70, 5, 20, Color::BLACK); // TODO: Render stuff //Initial Option placeholder words in the main menu @@ -84,37 +82,33 @@ impl MainMenu { draw.draw_text("Leaderboard", 100, 470, 34, Color::BLACK); draw.draw_text("Exit", 100, 550, 34, Color::BLACK); - //Unsafe block?? - unsafe { //First two are starting X and Y position, last two finishing X and Y. Made to resemble a box - if GetMouseX() >= 100 && GetMouseY() >= 193 && GetMouseX() <= 290 && GetMouseY() <= 216 - { + + if mouse_x >= 100 && mouse_y >= 193 && mouse_x <= 290 && mouse_y <= 216{ //Insides while make a lil shade for it to look cool draw.draw_text("Start Game", 103, 191, 34, Color::GRAY); draw.draw_text("Start Game", 100, 190, 34, Color::BLACK); - if IsMouseButtonDown(0) { - return MenuStateSignal::StartGame; - } + if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) { + return true; + } } - if GetMouseX() >= 100 && GetMouseY() >= 250 && GetMouseX() <= 222 && GetMouseY() <= 275 - { + if mouse_x >= 100 && mouse_y >= 250 && mouse_x <= 222 && mouse_y <= 275{ draw.draw_text("Options", 103, 251, 34, Color::GRAY); draw.draw_text("Options", 100, 250, 34, Color::BLACK); } - if GetMouseX() >= 100 && GetMouseY() >= 410 && GetMouseX() <= 222 && GetMouseY() <= 437 - { + + if mouse_x >= 100 && mouse_y >= 410 && mouse_x <= 222 && mouse_y <= 437{ draw.draw_text("Credits", 103, 411, 34, Color::GRAY); draw.draw_text("Credits", 100, 410, 34, Color::BLACK); } - if GetMouseX() >= 100 && GetMouseY() >= 470 && GetMouseX() <= 316 && GetMouseY() <= 496 - { + if mouse_x >= 100 && mouse_y >= 470 && mouse_x <= 316 && mouse_y <= 496{ draw.draw_text("Leaderboard", 103, 471, 34, Color::GRAY); draw.draw_text("Leaderboard", 100, 470, 34, Color::BLACK); } - if GetMouseX() >= 100 && GetMouseY() >= 550 && GetMouseX() <= 162 && GetMouseY() <= 575 - { + + if mouse_x >= 100 && mouse_y >= 550 && mouse_x <= 162 && mouse_y <= 575{ draw.draw_text("Exit", 103, 551, 34, Color::GRAY); draw.draw_text("Exit", 100, 550, 34, Color::BLACK); } @@ -159,5 +153,6 @@ impl MainMenu { ) -> MenuStateSignal { return MenuStateSignal::DoLeaderboard; + } }