Volume Button implementation
Color usage optimized and Volume Button implemented.
This commit is contained in:
parent
6f61eaf10c
commit
287f66361d
@ -1,5 +1,6 @@
|
|||||||
//! This scene encompasses the main menu system
|
//! This scene encompasses the main menu system
|
||||||
|
|
||||||
|
use na::Vector1;
|
||||||
use nalgebra as na;
|
use nalgebra as na;
|
||||||
use raylib::{
|
use raylib::{
|
||||||
ffi::{GetMouseX, GetMouseY, IsMouseButtonDown, Texture},
|
ffi::{GetMouseX, GetMouseY, IsMouseButtonDown, Texture},
|
||||||
@ -25,6 +26,7 @@ pub enum MenuStateSignal {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct MainMenu {
|
pub struct MainMenu {
|
||||||
has_updated_discord_rpc: bool,
|
has_updated_discord_rpc: bool,
|
||||||
|
volume_percentage: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MainMenu {
|
impl MainMenu {
|
||||||
@ -36,6 +38,7 @@ impl MainMenu {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
has_updated_discord_rpc: false,
|
has_updated_discord_rpc: false,
|
||||||
|
volume_percentage: 0.5,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,73 +73,131 @@ impl MainMenu {
|
|||||||
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();
|
||||||
|
|
||||||
//I wanna see where mouseeee
|
//TODO Errase later
|
||||||
draw.draw_text(&mouse_x.to_string(), 20, 5, 20, Color::BLACK);
|
draw.draw_text(&mouse_x.to_string(), 20, 5, 20, Color::BLACK);
|
||||||
draw.draw_text(&mouse_y.to_string(), 70, 5, 20, Color::BLACK);
|
draw.draw_text(&mouse_y.to_string(), 70, 5, 20, Color::BLACK);
|
||||||
|
|
||||||
|
//Screen Size
|
||||||
|
let window_height = draw.get_screen_height();
|
||||||
|
let window_width = draw.get_screen_width();
|
||||||
|
|
||||||
// TODO: Render stuff
|
// TODO: Render stuff
|
||||||
|
//Label Colors
|
||||||
|
let label_colors = Color::BLACK;
|
||||||
|
let label_shadow_colors = Color::GRAY;
|
||||||
|
|
||||||
//Initial Option placeholder words in the main menu
|
//Initial Option placeholder words in the main menu
|
||||||
draw.draw_text("Game Title", 100, 90, 60, Color::BLACK);
|
draw.draw_text("Game Title", 100, 90, 60, label_colors);
|
||||||
draw.draw_text("Start Game", 100, 190, 34, Color::BLACK);
|
draw.draw_text("Start Game", 100, 190, 34, label_colors);
|
||||||
draw.draw_text("Options", 100, 250, 34, Color::BLACK);
|
draw.draw_text("Credits", 100, 410, 34, label_colors);
|
||||||
draw.draw_text("Volume", 100, 300, 34, Color::BLACK);
|
draw.draw_text("Leaderboard", 100, 470, 34, label_colors);
|
||||||
draw.draw_text("Credits", 100, 410, 34, Color::BLACK);
|
draw.draw_text("Exit", 100, 550, 34, label_colors);
|
||||||
draw.draw_text("Leaderboard", 100, 470, 34, Color::BLACK);
|
|
||||||
draw.draw_text("Exit", 100, 550, 34, Color::BLACK);
|
|
||||||
|
|
||||||
//First two are starting X and Y position, last two finishing X and Y. Made to resemble a box
|
//First two are starting X and Y position, last two finishing X and Y. Made to resemble a box
|
||||||
|
|
||||||
if mouse_x >= 100 && mouse_y >= 193 && mouse_x <= 290 && mouse_y <= 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
|
//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", 103, 191, 34, label_shadow_colors);
|
||||||
draw.draw_text("Start Game", 100, 190, 34, Color::BLACK);
|
draw.draw_text("Start Game", 100, 190, 34, label_colors);
|
||||||
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
return MenuStateSignal::StartGame;
|
return MenuStateSignal::StartGame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
|
||||||
return MenuStateSignal::DoOptions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if mouse_x >= 100 && mouse_y >= 410 && mouse_x <= 222 && mouse_y <= 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", 103, 411, 34, label_shadow_colors);
|
||||||
draw.draw_text("Credits", 100, 410, 34, Color::BLACK);
|
draw.draw_text("Credits", 100, 410, 34, label_colors);
|
||||||
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
return MenuStateSignal::DoCredits;
|
return MenuStateSignal::DoCredits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if mouse_x >= 100 && mouse_y >= 470 && mouse_x <= 316 && mouse_y <= 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", 103, 471, 34, label_shadow_colors);
|
||||||
draw.draw_text("Leaderboard", 100, 470, 34, Color::BLACK);
|
draw.draw_text("Leaderboard", 100, 470, 34, label_colors);
|
||||||
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
return MenuStateSignal::DoLeaderboard;
|
return MenuStateSignal::DoLeaderboard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if mouse_x >= 100 && mouse_y >= 300 && mouse_x <= 215 && mouse_y <= 330 {
|
//Volume Controller
|
||||||
draw.draw_text("Volume", 103, 301, 34, Color::GRAY);
|
//Color Pallete Variables
|
||||||
draw.draw_text("Volume", 100, 300, 34, Color::BLACK);
|
let tile_color = Color::new(158, 93, 65, 255);
|
||||||
|
let outer_ring_color = Color::new(255, 191, 113, 255);
|
||||||
|
let inner_ring_color = Color::new(244, 203, 184, 255);
|
||||||
|
let button_color = Color::new(82, 135, 195, 255);
|
||||||
|
let button_shadow_color = Color::new(123, 201, 244, 255);
|
||||||
|
|
||||||
|
//Inner pieces of the controller
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 275.0, 235.0, 0, tile_color);//tile1
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 225.0, 185.0, 0, tile_color);//tile2
|
||||||
|
|
||||||
|
//- button
|
||||||
|
draw.draw_rectangle(window_width - 133, window_height - 128, 21, 5, button_color);
|
||||||
|
//+ button
|
||||||
|
draw.draw_rectangle(window_width - 62, window_height - 135, 5, 20, button_color); // vertical line
|
||||||
|
draw.draw_rectangle(window_width - 70, window_height - 128, 21, 5, button_color); //horizontal line
|
||||||
|
|
||||||
|
//Drawing external ring and internal ring
|
||||||
|
draw.draw_ring_lines(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 315.0, 45.0, 1, outer_ring_color);//Outer
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 275.0, 85.0, 1, inner_ring_color);//Inner
|
||||||
|
|
||||||
|
//Tiles shown depending on volume_percentage's value
|
||||||
|
if self.volume_percentage == 1.0 {
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 125.0, 85.0, 0, tile_color);//tile4
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 175.0, 135.0, 0, tile_color);//tile3
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 225.0, 185.0, 0, tile_color);//tile2
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 275.0, 235.0, 0, tile_color);//tile1
|
||||||
|
} else if self.volume_percentage == 0.75 {
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 175.0, 135.0, 0, tile_color);//tile3
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 225.0, 185.0, 0, tile_color);//tile2
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 275.0, 235.0, 0, tile_color);//tile1
|
||||||
|
} else if self.volume_percentage == 0.5 {
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 225.0, 185.0, 0, tile_color);//tile2
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 275.0, 235.0, 0, tile_color);//tile1
|
||||||
|
} else if self.volume_percentage == 0.25 {
|
||||||
|
draw.draw_ring(Vector2::new((window_width as f32) - 90.0, (window_height as f32) - 140.0), 50.0, 15.0, 275.0, 235.0, 0, tile_color);//tile1
|
||||||
|
} else if self.volume_percentage == 0.0 {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Button functionality
|
||||||
|
if mouse_x >= (window_width - 133) && mouse_y >= (window_height - 135) && mouse_x <= (window_width - 112) && mouse_y <= (window_height - 115) {
|
||||||
|
draw.draw_rectangle(window_width - 130, window_height - 127, 21, 5, button_shadow_color);
|
||||||
|
draw.draw_rectangle(window_width - 133, window_height - 128, 21, 5, button_color);
|
||||||
|
|
||||||
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
//Function for Volume here
|
if self.volume_percentage <= 1.0 && self.volume_percentage > 0.0 {
|
||||||
|
self.volume_percentage = self.volume_percentage - 0.25
|
||||||
|
} else if self.volume_percentage <= 0.0{
|
||||||
|
self.volume_percentage = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// + Button functionallity
|
||||||
|
if mouse_x >= (window_width - 70) && mouse_y >= (window_height - 135) && mouse_x <= (window_width - 49) && mouse_y <= (window_height - 115) {
|
||||||
|
draw.draw_rectangle(window_width - 59, window_height - 134, 5, 20, button_shadow_color);//Vertical Line
|
||||||
|
draw.draw_rectangle(window_width - 67, window_height - 127, 21, 5, button_shadow_color);
|
||||||
|
|
||||||
|
draw.draw_rectangle(window_width - 62, window_height - 135, 5, 20, button_color); // vertical line
|
||||||
|
draw.draw_rectangle(window_width - 70, window_height - 128, 21, 5, button_color); //horizontal line
|
||||||
|
|
||||||
|
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
|
if self.volume_percentage < 1.0 && self.volume_percentage >= 0.0 {
|
||||||
|
self.volume_percentage = self.volume_percentage + 0.25
|
||||||
|
} else if self.volume_percentage <= 0.0{
|
||||||
|
self.volume_percentage = 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Exit button has no function yet
|
//Exit button
|
||||||
if mouse_x >= 100 && mouse_y >= 550 && mouse_x <= 162 && mouse_y <= 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", 103, 551, 34, label_shadow_colors);
|
||||||
draw.draw_text("Exit", 100, 550, 34, Color::BLACK);
|
draw.draw_text("Exit", 100, 550, 34, label_colors);
|
||||||
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
if draw.is_mouse_button_pressed(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
return MenuStateSignal::QuitGame;
|
return MenuStateSignal::QuitGame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Return MenuStateSignal::StartGame if you want the game to start.
|
// Return MenuStateSignal::StartGame if you want the game to start.
|
||||||
// Otherwise, keep returning MenuStateSignal::DoMainMenu until the player clicks the start button
|
// Otherwise, keep returning MenuStateSignal::DoMainMenu until the player clicks the start button
|
||||||
return MenuStateSignal::DoMainMenu;
|
return MenuStateSignal::DoMainMenu;
|
||||||
@ -151,36 +212,8 @@ impl MainMenu {
|
|||||||
constants: &ProjectConstants,
|
constants: &ProjectConstants,
|
||||||
) -> MenuStateSignal {
|
) -> MenuStateSignal {
|
||||||
|
|
||||||
//Draw declared
|
//Options Errased, Block of code left for precaution
|
||||||
let mut draw = raylib.begin_drawing(rl_thread);
|
return MenuStateSignal::DoMainMenu;
|
||||||
draw.clear_background(Color::WHITE);
|
|
||||||
//Mouse Position
|
|
||||||
let mouse_x = draw.get_mouse_x();
|
|
||||||
let mouse_y = draw.get_mouse_y();
|
|
||||||
//Show mouse position
|
|
||||||
draw.draw_text(&mouse_x.to_string(), 20, 5, 20, Color::BLACK);
|
|
||||||
draw.draw_text(&mouse_y.to_string(), 70, 5, 20, Color::BLACK);
|
|
||||||
|
|
||||||
//Top Label
|
|
||||||
draw.draw_text("Options", 25, 30, 55, Color::BLACK);
|
|
||||||
|
|
||||||
//Window size storing variables
|
|
||||||
let window_height = draw.get_screen_height();
|
|
||||||
let window_width = draw.get_screen_width();
|
|
||||||
|
|
||||||
//Return button variables
|
|
||||||
let button_pos_x = 100; //116 Wide
|
|
||||||
let button_pos_y = window_height - (window_height/5); //26 height
|
|
||||||
|
|
||||||
draw.draw_text("Return", button_pos_x, button_pos_y, 34, Color::BLACK);
|
|
||||||
if mouse_x >= 100 && mouse_y >= button_pos_y && mouse_x <= 216 && mouse_y <= (window_height - (window_height/5)) + 26 {
|
|
||||||
draw.draw_text("Return", button_pos_x + 3, button_pos_y + 1, 34, Color::GRAY);
|
|
||||||
draw.draw_text("Return", button_pos_x, button_pos_y, 34, Color::BLACK);
|
|
||||||
if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) {
|
|
||||||
return MenuStateSignal::DoMainMenu; //Goes back to main menu
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return MenuStateSignal::DoOptions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn render_credits_frame(
|
pub async fn render_credits_frame(
|
||||||
@ -191,12 +224,18 @@ impl MainMenu {
|
|||||||
global_resources: &GlobalResources,
|
global_resources: &GlobalResources,
|
||||||
constants: &ProjectConstants,
|
constants: &ProjectConstants,
|
||||||
) -> MenuStateSignal {
|
) -> MenuStateSignal {
|
||||||
|
//Colors
|
||||||
|
let label_colors = Color::BLACK;
|
||||||
|
let label_shadow_colors = Color::GRAY;
|
||||||
|
let credits_colours = Color::new(82, 135, 195, 255);
|
||||||
|
|
||||||
let mut draw = raylib.begin_drawing(rl_thread);
|
let mut draw = raylib.begin_drawing(rl_thread);
|
||||||
draw.clear_background(Color::WHITE);
|
draw.clear_background(Color::WHITE);
|
||||||
//Mouse Position
|
//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();
|
||||||
//Show mouse position
|
|
||||||
|
//TODO Errase in the end Show mouse position
|
||||||
draw.draw_text(&mouse_x.to_string(), 20, 5, 20, Color::BLACK);
|
draw.draw_text(&mouse_x.to_string(), 20, 5, 20, Color::BLACK);
|
||||||
draw.draw_text(&mouse_y.to_string(), 70, 5, 20, Color::BLACK);
|
draw.draw_text(&mouse_y.to_string(), 70, 5, 20, Color::BLACK);
|
||||||
|
|
||||||
@ -204,26 +243,26 @@ impl MainMenu {
|
|||||||
let window_height = draw.get_screen_height();
|
let window_height = draw.get_screen_height();
|
||||||
let window_width = draw.get_screen_width();
|
let window_width = draw.get_screen_width();
|
||||||
|
|
||||||
draw.draw_text("Credits", (window_width/2) - 100, 30, 55, Color::BLACK);
|
draw.draw_text("Credits", (window_width/2) - 100, 30, 55, label_colors);
|
||||||
|
|
||||||
draw.draw_text("Carter Tomlenovich", (window_width/2) - 170, 120, 40, Color::DARKBLUE);
|
draw.draw_text("Carter Tomlenovich", (window_width/2) - 170, 120, 40, credits_colours);
|
||||||
draw.draw_text("Emilia Firas", (window_width/2) - 170, 160, 40, Color::DARKBLUE);
|
draw.draw_text("Emilia Firas", (window_width/2) - 170, 160, 40, credits_colours);
|
||||||
draw.draw_text("Emmet Logue", (window_width/2) - 170, 200, 40, Color::DARKBLUE);
|
draw.draw_text("Emmet Logue", (window_width/2) - 170, 200, 40, credits_colours);
|
||||||
draw.draw_text("Evan Pratten", (window_width/2) - 170, 240, 40, Color::DARKBLUE);
|
draw.draw_text("Evan Pratten", (window_width/2) - 170, 240, 40, credits_colours);
|
||||||
draw.draw_text("James Nickoli", (window_width/2) - 170, 280, 40, Color::DARKBLUE);
|
draw.draw_text("James Nickoli", (window_width/2) - 170, 280, 40, credits_colours);
|
||||||
draw.draw_text("Marcelo Geldres", (window_width/2) - 170, 320, 40, Color::DARKBLUE);
|
draw.draw_text("Marcelo Geldres", (window_width/2) - 170, 320, 40, credits_colours);
|
||||||
draw.draw_text("Percy", (window_width/2) - 170, 360, 40, Color::DARKBLUE);
|
draw.draw_text("Percy", (window_width/2) - 170, 360, 40, credits_colours);
|
||||||
draw.draw_text("Silas Bartha", (window_width/2) - 170, 400, 40, Color::DARKBLUE);
|
draw.draw_text("Silas Bartha", (window_width/2) - 170, 400, 40, credits_colours);
|
||||||
draw.draw_text("Taya Armstrong", (window_width/2) - 170, 440, 40, Color::DARKBLUE);
|
draw.draw_text("Taya Armstrong", (window_width/2) - 170, 440, 40, credits_colours);
|
||||||
|
|
||||||
//Return button variables
|
//Return button variables
|
||||||
let button_pos_x = 100; //116 Wide
|
let button_pos_x = 100; //116 Wide
|
||||||
let button_pos_y = window_height - (window_height/5); //26 height
|
let button_pos_y = window_height - (window_height/5); //26 height
|
||||||
|
|
||||||
draw.draw_text("Return", button_pos_x, button_pos_y, 34, Color::BLACK);
|
draw.draw_text("Return", button_pos_x, button_pos_y, 34, label_colors);
|
||||||
if mouse_x >= 100 && mouse_y >= button_pos_y && mouse_x <= 216 && mouse_y <= (window_height - (window_height/5)) + 26 {
|
if mouse_x >= 100 && mouse_y >= button_pos_y && mouse_x <= 216 && mouse_y <= (window_height - (window_height/5)) + 26 {
|
||||||
draw.draw_text("Return", button_pos_x + 3, button_pos_y + 1, 34, Color::GRAY);
|
draw.draw_text("Return", button_pos_x + 3, button_pos_y + 1, 34, label_shadow_colors);
|
||||||
draw.draw_text("Return", button_pos_x, button_pos_y, 34, Color::BLACK);
|
draw.draw_text("Return", button_pos_x, button_pos_y, 34, label_colors);
|
||||||
if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) {
|
if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
return MenuStateSignal::DoMainMenu; //Goes back to main menu
|
return MenuStateSignal::DoMainMenu; //Goes back to main menu
|
||||||
}
|
}
|
||||||
@ -240,6 +279,11 @@ impl MainMenu {
|
|||||||
global_resources: &GlobalResources,
|
global_resources: &GlobalResources,
|
||||||
constants: &ProjectConstants,
|
constants: &ProjectConstants,
|
||||||
) -> MenuStateSignal {
|
) -> MenuStateSignal {
|
||||||
|
|
||||||
|
//Colors
|
||||||
|
let label_colors = Color::BLACK;
|
||||||
|
let label_shadow_colors = Color::GRAY;
|
||||||
|
|
||||||
let mut draw = raylib.begin_drawing(rl_thread);
|
let mut draw = raylib.begin_drawing(rl_thread);
|
||||||
draw.clear_background(Color::WHITE);
|
draw.clear_background(Color::WHITE);
|
||||||
//Mouse Position
|
//Mouse Position
|
||||||
@ -250,21 +294,21 @@ impl MainMenu {
|
|||||||
let window_height = draw.get_screen_height();
|
let window_height = draw.get_screen_height();
|
||||||
let window_width = draw.get_screen_width();
|
let window_width = draw.get_screen_width();
|
||||||
|
|
||||||
//Show mouse position
|
//TODO errase later
|
||||||
draw.draw_text(&mouse_x.to_string(), 20, 5, 20, Color::BLACK);
|
draw.draw_text(&mouse_x.to_string(), 20, 5, 20, Color::BLACK);
|
||||||
draw.draw_text(&mouse_y.to_string(), 70, 5, 20, Color::BLACK);
|
draw.draw_text(&mouse_y.to_string(), 70, 5, 20, Color::BLACK);
|
||||||
|
|
||||||
let window_width = draw.get_screen_width();
|
let window_width = draw.get_screen_width();
|
||||||
draw.draw_text("Leaderboard", (window_width/2) - 176, 30, 55, Color::BLACK);
|
draw.draw_text("Leaderboard", (window_width/2) - 176, 30, 55, label_colors);
|
||||||
|
|
||||||
//Return button variables
|
//Return button variables
|
||||||
let button_pos_x = 100; //116 Wide
|
let button_pos_x = 100; //116 Wide
|
||||||
let button_pos_y = window_height - (window_height/5); //26 height
|
let button_pos_y = window_height - (window_height/5); //26 height
|
||||||
|
|
||||||
draw.draw_text("Return", button_pos_x, button_pos_y, 34, Color::BLACK);
|
draw.draw_text("Return", button_pos_x, button_pos_y, 34, label_colors);
|
||||||
if mouse_x >= 100 && mouse_y >= button_pos_y && mouse_x <= 216 && mouse_y <= (window_height - (window_height/5)) + 26 {
|
if mouse_x >= 100 && mouse_y >= button_pos_y && mouse_x <= 216 && mouse_y <= (window_height - (window_height/5)) + 26 {
|
||||||
draw.draw_text("Return", button_pos_x + 3, button_pos_y + 1, 34, Color::GRAY);
|
draw.draw_text("Return", button_pos_x + 3, button_pos_y + 1, 34, label_shadow_colors);
|
||||||
draw.draw_text("Return", button_pos_x, button_pos_y, 34, Color::BLACK);
|
draw.draw_text("Return", button_pos_x, button_pos_y, 34, label_colors);
|
||||||
if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) {
|
if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
return MenuStateSignal::DoMainMenu; //Goes back to main menu
|
return MenuStateSignal::DoMainMenu; //Goes back to main menu
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user