Uploading assets & developing multiplayer implementations

This commit is contained in:
2026-05-20 12:11:04 +03:00
parent 446d0ede8e
commit 67f5fcf374
19 changed files with 59 additions and 14 deletions
+6 -10
View File
@@ -1,25 +1,21 @@
#include "menu.h"
void Menu::Update(GameState& currentState) {
int Menu::Update() {
// Handle Navigation
if (IsKeyPressed(KEY_DOWN)) {
selectedIndex++;
if (selectedIndex >= options.size()) selectedIndex = 0;
if (selectedIndex >= static_cast<int>(options.size())) selectedIndex = 0;
}
if (IsKeyPressed(KEY_UP)) {
selectedIndex--;
if (selectedIndex < 0) selectedIndex = options.size() - 1;
if (selectedIndex < 0) selectedIndex = static_cast<int>(options.size()) - 1;
}
// Handle Selection
if (IsKeyPressed(KEY_ENTER)) {
if (options[selectedIndex] == "Start Game") {
currentState = GameState::Playing;
}
else if (options[selectedIndex] == "Quit") {
currentState = GameState::GameOver;
}
return selectedIndex;
}
return -1;
}
void Menu::Draw() {
@@ -30,7 +26,7 @@ void Menu::Draw() {
DrawText(title.c_str(), screenWidth / 2 - MeasureText(title.c_str(), 60) / 2, screenHeight / 4, 60, WHITE);
// Draw Options
for (int i = 0; i < options.size(); i++) {
for (int i = 0; i < static_cast<int>(options.size()); i++) {
Color textColor = (i == selectedIndex) ? YELLOW : WHITE;
DrawText(options[i].c_str(), screenWidth / 2 - MeasureText(options[i].c_str(), 40) / 2, screenHeight / 2 + (i * 60), 40, textColor);
}