#include "mainMenu.h" MENU_GUI::PauseState MENU_GUI::pauseState{}; MENU_GUI::Game MENU_GUI::game{}; MENU_GUI::Click MENU_GUI::click{}; void MENU_GUI::mainMenu(Resources& resources, int& seed, int& levels, int& difficulty) { UI::startUIFrame(); if (pauseState.credits) { FRAME::creditsFrame(); } else if (pauseState.options) { FRAME::optionMenuFrame(resources); } else if (pauseState.archConfig) { FRAME::configureArchFrame(seed, levels, difficulty); } else if (pauseState.gameSelect) { if (pauseState.lore) { FRAME::loreFrame(); } else { FRAME::selectGameFrame(); } } else { FRAME::mainMenuFrame(); } UI::stopUIFrame(); } void MENU_GUI::FRAME::mainMenuFrame() { ImGui::Begin("The Archanist - Menu", nullptr, windowSettings()); ImGui::Text("Team Snow Squall "); if (ImGui::Button("Select Game")) { pauseState.gameSelect = true; click.occurred = true; } if (ImGui::Button("Settings")) { pauseState.options = true; click.occurred = true; } if (ImGui::Button("Credits")) { pauseState.credits = true; click.occurred = true; } if (ImGui::Button("Exit")) { pauseState.exit = true; click.occurred = true; } ImGui::End(); } void MENU_GUI::FRAME::optionMenuFrame(Resources& resources) { ImGui::Begin("The Archanist - Settings", nullptr, windowSettings()); ImGui::Text("The Archanist"); ImGui::Text(""); ImGui::Text("Video:"); ImGui::Text("Width:"); ImGui::PushItemWidth(350); ImGui::InputInt("##width", &resources.settings.width); ImGui::Text("Height:"); ImGui::PushItemWidth(350); ImGui::InputInt("##height", &resources.settings.height); ImGui::Text("Fullscreen: "); ImGui::SameLine(); ImGui::Checkbox("##fullscreen", &resources.settings.fullscreen); ImGui::Text("Vsync: "); ImGui::SameLine(); ImGui::Checkbox("##vsync", &resources.settings.vsync); ImGui::Text(""); ImGui::Text("Audio:"); ImGui::Text("Volume:"); ImGui::PushItemWidth(350); ImGui::InputFloat("##volume", &resources.settings.volume, 0.01f, 0.1f, "%.2f"); ImGui::Text("Mute: "); ImGui::SameLine(); ImGui::Checkbox("##mute", &resources.settings.mute); ImGui::Text(""); if (ImGui::Button("Return & Save")) { // Update settings function resources.settings.settingsUpdated = true; pauseState.options = false; click.occurred = true; } ImGui::End(); } void MENU_GUI::FRAME::selectGameFrame() { ImGui::Begin("The Archanist - GameSelect", nullptr, windowSettings()); ImGui::Text("Game Select"); ImGui::Text(""); ImGui::Text("The Archanist:"); ImGui::Text("Our diablo inspired dungeon crawler"); ImGui::Text(""); if (ImGui::Button("Lore")) { pauseState.lore = true; click.occurred = true; } if (ImGui::Button("Play The Archanist")) { pauseState.archConfig = true; click.occurred = true; } ImGui::Text(""); ImGui::Text("Shay's World:"); ImGui::Text("Our Assignment one game, transitions to the Archanist "); ImGui::Text(""); if (ImGui::Button("Play Shay's world")) { game.shaysWorld = true; click.occurred = true; } ImGui::Text(""); if (ImGui::Button("Return")) { resetPauseState(); click.occurred = true; } ImGui::End(); } void MENU_GUI::FRAME::creditsFrame() { ImGui::Begin("The Archanist - credits", nullptr, windowSettings()); ImGui::Text( "Credits\n\nChase Percy\nMatthew Davis\nMichael John\n\nThanks for " "playing!\n\n"); if (ImGui::Button("Return")) { pauseState.credits = false; click.occurred = true; } ImGui::End(); } void MENU_GUI::FRAME::configureArchFrame(int& seed, int& levels, int& difficulty) { ImGui::Begin("The Archanist - GameSelect", nullptr, windowSettings()); ImGui::Text("The Archanist Setup"); ImGui::Text(""); ImGui::Text("Seed: "); ImGui::PushItemWidth(350); ImGui::InputInt("##seed", &seed); ImGui::Text(""); ImGui::Text("Levels: "); ImGui::PushItemWidth(350); ImGui::InputInt("##levels", &levels); ImGui::Text(""); ImGui::Text("Difficulty: "); ImGui::RadioButton("Easy", &difficulty, 0); ImGui::RadioButton("Normal", &difficulty, 1); ImGui::RadioButton("Hard", &difficulty, 2); ImGui::Text(""); if (ImGui::Button("Play")) { game.archanist = true; click.occurred = true; } ImGui::Text(""); if (ImGui::Button("Return")) { pauseState.archConfig = false; click.occurred = true; } ImGui::End(); } void MENU_GUI::FRAME::loreFrame() { ImGui::Begin("The Archanist - GameSelect", nullptr, windowSettings()); ImGui::Text("The Archanist Lore\n\n"); ImGui::Text( "As the archanist you are a lone sorcerer intent on finding and " "destroying the\n" "scourge and evil from the depths of the mystic Bolton dungeons."); ImGui::Text( "\nAt the deepest level of the dungeon waits the keeper who " "abuses\nthe power of the Bolton Grimoire to convert the dead and\n" "innocent creatures to bid his evil deeds."); ImGui::Text( "\nIt is up to you to explore the dungeon, destroying his minions and " "lords along the\nway until you can finally destroy both the keeper " "and Grimoire itself before evil\nspreads from the depths to all " "above!"); ImGui::Text("\nDo you have what it takes archanist?\n\n"); if (ImGui::Button("Return")) { pauseState.lore = false; click.occurred = true; } ImGui::End(); } int MENU_GUI::FRAME::windowSettings() { return ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove; } void MENU_GUI::resetPauseState() { pauseState.gameSelect = false; pauseState.options = false; pauseState.exit = false; pauseState.archConfig = false; pauseState.credits = false; game.shaysWorld = false; game.archanist = false; }