From fc8c9e8f025f6615d74828c14035c988bba0c2b0 Mon Sep 17 00:00:00 2001 From: Marcelo Geldres Date: Sat, 2 Apr 2022 09:18:56 -0400 Subject: [PATCH] Main Menu Initial Layout --- game/game_logic/src/scenes/main_menu.rs | 57 ++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/game/game_logic/src/scenes/main_menu.rs b/game/game_logic/src/scenes/main_menu.rs index da3d1dec..71a1a575 100644 --- a/game/game_logic/src/scenes/main_menu.rs +++ b/game/game_logic/src/scenes/main_menu.rs @@ -1,7 +1,7 @@ //! This scene encompasses the main menu system use nalgebra as na; -use raylib::prelude::*; +use raylib::{prelude::*, ffi::{Texture, GetMouseX, GetMouseY, IsMouseButtonDown}}; use crate::{ discord::{DiscordChannel, DiscordRpcSignal}, @@ -57,8 +57,61 @@ impl MainMenu { // Clear the screen draw.clear_background(Color::WHITE); - // TODO: Render stuff + //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); + } + + + + // TODO: Render stuff + //Initial Option placeholder words in the main menu + draw.draw_text("Game Title", 100, 90, 60, Color::BLACK); + draw.draw_text("Start Game", 100, 190, 34, Color::BLACK); + draw.draw_text("Options", 100, 250, 34, Color::BLACK); + draw.draw_text("Credits", 100, 410, 34, Color::BLACK); + 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{ + //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; + } + } + + if GetMouseX() >= 100 && GetMouseY() >= 250 && GetMouseX() <= 222 && GetMouseY() <= 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{ + 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{ + 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{ + 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