Main Menu Initial Layout

This commit is contained in:
Marcelo Geldres 2022-04-02 09:18:56 -04:00
parent 33e21f2759
commit fc8c9e8f02

View File

@ -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