Fully responsive layout
Some parts were not responsive to the window size. they were corrected
This commit is contained in:
parent
03398a60d3
commit
d0eb5c5358
@ -161,16 +161,22 @@ impl MainMenu {
|
|||||||
//Top Label
|
//Top Label
|
||||||
draw.draw_text("Options", 25, 30, 55, Color::BLACK);
|
draw.draw_text("Options", 25, 30, 55, Color::BLACK);
|
||||||
|
|
||||||
//Return Button
|
//Window size storing variables
|
||||||
draw.draw_text("Return", 100, 550, 34, Color::BLACK);
|
let window_height = draw.get_screen_height();
|
||||||
if mouse_x >= 100 && mouse_y >= 550 && mouse_x <= 216 && mouse_y <= 576 {
|
let window_width = draw.get_screen_width();
|
||||||
draw.draw_text("Return", 103, 551, 34, Color::GRAY);
|
|
||||||
draw.draw_text("Return", 100, 550, 34, Color::BLACK);
|
//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) {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return MenuStateSignal::DoOptions;
|
return MenuStateSignal::DoOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,28 +198,31 @@ impl MainMenu {
|
|||||||
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
|
//Screen Size
|
||||||
// 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, Color::BLACK);
|
||||||
|
|
||||||
draw.draw_text("Carter Tomlenovich", (window_width/2) - 170, 280, 40, Color::DARKBLUE);
|
draw.draw_text("Carter Tomlenovich", (window_width/2) - 170, 120, 40, Color::DARKBLUE);
|
||||||
draw.draw_text("Emilia Firas", (window_width/2) - 170, 120, 40, Color::DARKBLUE);
|
draw.draw_text("Emilia Firas", (window_width/2) - 170, 160, 40, Color::DARKBLUE);
|
||||||
draw.draw_text("Emmet Logue", (window_width/2) - 170, 320, 40, Color::DARKBLUE);
|
draw.draw_text("Emmet Logue", (window_width/2) - 170, 200, 40, Color::DARKBLUE);
|
||||||
draw.draw_text("Evan Pratten", (window_width/2) - 170, 160, 40, Color::DARKBLUE);
|
draw.draw_text("Evan Pratten", (window_width/2) - 170, 240, 40, Color::DARKBLUE);
|
||||||
draw.draw_text("James Nickoli", (window_width/2) - 170, 240, 40, Color::DARKBLUE);
|
draw.draw_text("James Nickoli", (window_width/2) - 170, 280, 40, Color::DARKBLUE);
|
||||||
draw.draw_text("Marcelo Geldres", (window_width/2) - 170, 440, 40, Color::DARKBLUE);
|
draw.draw_text("Marcelo Geldres", (window_width/2) - 170, 320, 40, Color::DARKBLUE);
|
||||||
draw.draw_text("Percy", (window_width/2) - 170, 400, 40, Color::DARKBLUE);
|
draw.draw_text("Percy", (window_width/2) - 170, 360, 40, Color::DARKBLUE);
|
||||||
draw.draw_text("Silas Bartha", (window_width/2) - 170, 200, 40, Color::DARKBLUE);
|
draw.draw_text("Silas Bartha", (window_width/2) - 170, 400, 40, Color::DARKBLUE);
|
||||||
draw.draw_text("Taya Armstrong", (window_width/2) - 170, 360, 40, Color::DARKBLUE);
|
draw.draw_text("Taya Armstrong", (window_width/2) - 170, 440, 40, Color::DARKBLUE);
|
||||||
|
|
||||||
//Return Button
|
//Return button variables
|
||||||
draw.draw_text("Return", 100, 550, 34, Color::BLACK);
|
let button_pos_x = 100; //116 Wide
|
||||||
if mouse_x >= 100 && mouse_y >= 550 && mouse_x <= 216 && mouse_y <= 576 {
|
let button_pos_y = window_height - (window_height/5); //26 height
|
||||||
draw.draw_text("Return", 103, 551, 34, Color::GRAY);
|
|
||||||
draw.draw_text("Return", 100, 550, 34, Color::BLACK);
|
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) {
|
if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
return MenuStateSignal::DoMainMenu;
|
return MenuStateSignal::DoMainMenu; //Goes back to main menu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +243,10 @@ 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();
|
||||||
|
|
||||||
|
//Window size storing variables
|
||||||
|
let window_height = draw.get_screen_height();
|
||||||
|
let window_width = draw.get_screen_width();
|
||||||
|
|
||||||
//Show mouse position
|
//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);
|
||||||
@ -241,13 +254,16 @@ impl MainMenu {
|
|||||||
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, Color::BLACK);
|
||||||
|
|
||||||
//Return Button
|
//Return button variables
|
||||||
draw.draw_text("Return", 100, 550, 34, Color::BLACK);
|
let button_pos_x = 100; //116 Wide
|
||||||
if mouse_x >= 100 && mouse_y >= 550 && mouse_x <= 216 && mouse_y <= 576 {
|
let button_pos_y = window_height - (window_height/5); //26 height
|
||||||
draw.draw_text("Return", 103, 551, 34, Color::GRAY);
|
|
||||||
draw.draw_text("Return", 100, 550, 34, Color::BLACK);
|
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) {
|
if draw.is_mouse_button_down(MouseButton::MOUSE_LEFT_BUTTON) {
|
||||||
return MenuStateSignal::DoMainMenu;
|
return MenuStateSignal::DoMainMenu; //Goes back to main menu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user