Finalize Pause menu and setup of settings menu.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include <Client/CreditsWindow.hpp>
|
||||
#include "ClientApp/CaveGameWindow.hpp"
|
||||
|
||||
#include <Client/SettingsMenu.hpp>
|
||||
#include <bits/random.h>
|
||||
#include <Core/Explosion.hpp>
|
||||
#include <Core/Loggers.hpp>
|
||||
@@ -46,8 +46,17 @@ namespace CaveGame::ClientApp {
|
||||
{
|
||||
Logs::Info(std::format("Game session requested.", info.NewWorld));
|
||||
game_ctx = new CaveGame::Client::GameSession(info.NewWorld);
|
||||
|
||||
// TODO: Parse Info to construct gameworld files.
|
||||
ChangeScene(game_ctx);
|
||||
|
||||
game_ctx->RequestToggleSettings += [&, this] mutable {
|
||||
settings_window->Toggle();
|
||||
};
|
||||
|
||||
game_ctx->OnSessionExit += [&, this] mutable {
|
||||
ChangeScene(menu_ctx);
|
||||
};
|
||||
}
|
||||
|
||||
void CaveGameWindow::CreateContexts()
|
||||
@@ -56,18 +65,15 @@ namespace CaveGame::ClientApp {
|
||||
splash_ctx = new CaveGame::Client::Splash();
|
||||
Logs::Info("Building main menu.");
|
||||
menu_ctx = new CaveGame::Client::MainMenu();
|
||||
game_ctx = new CaveGame::Client::GameSession();
|
||||
|
||||
menu_ctx->RequestWorld += [this](Client::SingleplayerSessionInfo info) {
|
||||
OpenWorld(info);
|
||||
};
|
||||
menu_ctx->RequestQuit += [this]() {
|
||||
Die();
|
||||
};
|
||||
menu_ctx->RequestShowCredits += [this]()
|
||||
{
|
||||
credits_window->Visible(true);
|
||||
};
|
||||
menu_ctx->RequestQuit += [this] { Die(); };
|
||||
menu_ctx->RequestToggleCredits += [this]{ credits_window->Toggle(); };
|
||||
menu_ctx->RequestToggleSettings += [this] { settings_window->Toggle(); };
|
||||
|
||||
game_ctx = new CaveGame::Client::GameSession();
|
||||
}
|
||||
|
||||
void CaveGameWindow::CreateMenuWindows()
|
||||
@@ -154,10 +160,7 @@ namespace CaveGame::ClientApp {
|
||||
|
||||
void CaveGameWindow::create_settings_window()
|
||||
{
|
||||
settings_window = new JUI::Window(wm);
|
||||
settings_window->SetTitleFont(JGL::Fonts::Jupiteroid);
|
||||
settings_window->SetTitle("Settings");
|
||||
settings_window->Visible(false);
|
||||
settings_window = new Client::SettingsMenu(wm);
|
||||
}
|
||||
|
||||
|
||||
@@ -236,9 +239,10 @@ namespace CaveGame::ClientApp {
|
||||
|
||||
void CaveGameWindow::Update(float elapsed)
|
||||
{
|
||||
|
||||
jstick::ReadEventLoop();
|
||||
|
||||
SceneManager::UpdateSceneState(elapsed);
|
||||
|
||||
// Update floating windows.
|
||||
wm->Update(elapsed);
|
||||
|
||||
|
Reference in New Issue
Block a user