Return to Main menu
and color varaibles too
This commit is contained in:
parent
76aede470b
commit
fa7aa4d7ff
@ -46,9 +46,17 @@ impl PauseMenu {
|
|||||||
// Get a drawing handle
|
// Get a drawing handle
|
||||||
let mut draw = raylib.begin_drawing(rl_thread);
|
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
|
// Clear the screen
|
||||||
draw.clear_background(Color::WHITE);
|
draw.clear_background(Color::WHITE);
|
||||||
|
|
||||||
|
//Color Pallette
|
||||||
|
let label_colors = Color::BLACK;
|
||||||
|
let label_shadow_colors = Color::GRAY;
|
||||||
|
|
||||||
//Obtain mouse position
|
//Obtain mouse position
|
||||||
let mouse_x = draw.get_mouse_x();
|
let mouse_x = draw.get_mouse_x();
|
||||||
let mouse_y = draw.get_mouse_y();
|
let mouse_y = draw.get_mouse_y();
|
||||||
@ -70,7 +78,41 @@ impl PauseMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Title
|
// 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 button_pos_x = 100; //116 Wide
|
||||||
|
let button_pos_y = window_height - (window_height / 5); //26 height
|
||||||
|
//Return to Main Menu Button
|
||||||
|
draw.draw_text("Return to Main Menu", button_pos_x, button_pos_y, 34, label_colors);
|
||||||
|
if mouse_x >= button_pos_x
|
||||||
|
&& mouse_y >= button_pos_y
|
||||||
|
&& mouse_x <= button_pos_x + 352
|
||||||
|
&& mouse_y <= button_pos_y + 23
|
||||||
|
{
|
||||||
|
draw.draw_text(
|
||||||
|
"Return to Main Menu",
|
||||||
|
button_pos_x + 3,
|
||||||
|
button_pos_y + 1,
|
||||||
|
34,
|
||||||
|
label_shadow_colors,
|
||||||
|
);
|
||||||
|
draw.draw_text(
|
||||||
|
"Return to Main Menu",
|
||||||
|
button_pos_x,
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Let the user leave this menu by pressing escape
|
// Let the user leave this menu by pressing escape
|
||||||
if draw.is_key_pressed(KeyboardKey::KEY_ESCAPE) {
|
if draw.is_key_pressed(KeyboardKey::KEY_ESCAPE) {
|
||||||
|
Reference in New Issue
Block a user