diff --git a/game/game_logic/src/scenes/main_menu.rs b/game/game_logic/src/scenes/main_menu.rs index 71a1a575..3c2ebe1c 100644 --- a/game/game_logic/src/scenes/main_menu.rs +++ b/game/game_logic/src/scenes/main_menu.rs @@ -58,15 +58,16 @@ impl MainMenu { draw.clear_background(Color::WHITE); //I wanna see where mouseeee + let mouse_x; + let mouse_y; + 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); + mouse_x = GetMouseX(); + mouse_y = GetMouseY(); } - + 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 @@ -77,42 +78,40 @@ 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 true; + unsafe{ //I think I still need unsafe here + if IsMouseButtonDown(0) { + 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); } - } - // Return true if you want the game to start. // Otherwise, keep returning false until the player clicks the start button return false;