Module game_logic::scenes::pause_menu [−][src]
Expand description
This scene encompasses the main menu system
+Module pause_menu
Module game_logic::scenes::pause_menu [−][src]
Expand description
This scene encompasses the main menu system
Structs
Struct game_logic::scenes::pause_menu::PauseMenu [−][src]
pub struct PauseMenu {
show_debug_info: bool,
-}
Fields
show_debug_info: bool
Implementations
pub fn new(
raylib_handle: &mut RaylibHandle,
thread: &RaylibThread,
constants: &ProjectConstants,
game_settings: &mut PersistentGameSettings
) -> Self
pub fn new(
raylib_handle: &mut RaylibHandle,
thread: &RaylibThread,
constants: &ProjectConstants,
game_settings: &mut PersistentGameSettings
) -> Self
Construct a new PauseMenu
Trait Implementations
Formats the value using the given formatter. Read more
+}Fields
show_debug_info: bool
Implementations
pub fn new(
raylib_handle: &mut RaylibHandle,
thread: &RaylibThread,
constants: &ProjectConstants,
game_settings: &mut PersistentGameSettings
) -> Self
pub fn new(
raylib_handle: &mut RaylibHandle,
thread: &RaylibThread,
constants: &ProjectConstants,
game_settings: &mut PersistentGameSettings
) -> Self
Construct a new PauseMenu
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PauseMenu
impl UnwindSafe for PauseMenu
Blanket Implementations
Mutably borrows from an owned value. Read more
diff --git a/rustdoc/src/game_logic/scenes/pause_menu.rs.html b/rustdoc/src/game_logic/scenes/pause_menu.rs.html index 5a71a48e..a65ebf1c 100644 --- a/rustdoc/src/game_logic/scenes/pause_menu.rs.html +++ b/rustdoc/src/game_logic/scenes/pause_menu.rs.html @@ -1,91 +1,161 @@1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156//! This scene encompasses the main menu system use na::Vector1; @@ -134,9 +204,17 @@ // Get a drawing handle let mut draw = raylib.begin_drawing(rl_thread); + //Screen Size + let window_height = draw.get_screen_height(); + let window_width = draw.get_screen_width(); + // Clear the screen draw.clear_background(Color::WHITE); + //Color Pallette + let label_colors = Color::BLACK; + let label_shadow_colors = Color::GRAY; + //Obtain mouse position let mouse_x = draw.get_mouse_x(); let mouse_y = draw.get_mouse_y(); @@ -158,7 +236,69 @@ } // Title - draw.draw_text("Paused", 100, 90, 60, Color::BLACK); + draw.draw_text("Paused", 100, 90, 60, label_colors); + + //Return to Main Menu button variables + let return_button_pos_x = 100; //116 Wide + let return_button_pos_y = 400; //26 height + //Return to Main Menu Button + draw.draw_text("Return to Main Menu", return_button_pos_x, return_button_pos_y, 34, label_colors); + if mouse_x >= return_button_pos_x + && mouse_y >= return_button_pos_y + && mouse_x <= return_button_pos_x + 352 + && mouse_y <= return_button_pos_y + 23 + { + draw.draw_text( + "Return to Main Menu", + return_button_pos_x + 3, + return_button_pos_y + 1, + 34, + label_shadow_colors, + ); + draw.draw_text( + "Return to Main Menu", + return_button_pos_x, + return_button_pos_y, + 34, + label_colors + ); + + if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) { + audio_subsystem.play_sound(&global_resources.button_click_sound); + return MenuStateSignal::DoMainMenu; //Goes back to main menu + } + } + + //Return to Game button variables + let to_game_button_pos_x = 100; //116 Wide + let to_game_button_pos_y = 300; //26 height + + draw.draw_text("Return to Game", to_game_button_pos_x, to_game_button_pos_y, 34, label_colors); + if mouse_x >= to_game_button_pos_x + && mouse_y >= to_game_button_pos_y + && mouse_x <= to_game_button_pos_x + 262 + && mouse_y <= to_game_button_pos_y + 23 + { + draw.draw_text( + "Return to Game", + to_game_button_pos_x + 3, + to_game_button_pos_y + 1, + 34, + label_shadow_colors, + ); + draw.draw_text( + "Return to Game", + to_game_button_pos_x, + to_game_button_pos_y, + 34, + label_colors + ); + + if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) { + audio_subsystem.play_sound(&global_resources.button_click_sound); + return MenuStateSignal::StartGame; //Goes back to Game + } + } // Let the user leave this menu by pressing escape if draw.is_key_pressed(KeyboardKey::KEY_ESCAPE) {