#include #include #include #include namespace td { MainMenuState::MainMenuState(Display& a_Display) : DisplayState(a_Display) { PushState(); } MainMenuState::~MainMenuState() {} static int GetWindowFullScreenFlags() { return ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoBackground; } static void SetNextWindowFullScreen() { const ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(viewport->WorkPos); ImGui::SetNextWindowSize(viewport->WorkSize); } void MainMenuState::Update(float a_Delta) { SetNextWindowFullScreen(); ImGui::Begin("MainWindow", nullptr, GetWindowFullScreenFlags()); MainMenuStateStack::Update(); ImGui::End(); } void MainMenuState::RenderBackButton() { if (ImGui::Button("Back")) PopState(); } void MainMenuState::OnKeyDown(SDL_Keycode a_Key) { if (a_Key == SDLK_ESCAPE) PopState(); } } // namespace td