Putting together PauseMenu functionality.

This commit is contained in:
2025-04-10 13:58:51 -04:00
parent 1cbed8ce7f
commit 35298ec28d
5 changed files with 17 additions and 13 deletions

View File

@@ -9,7 +9,6 @@
/// @edit 1/28/2025
/// @auth Josh O'Leary
#pragma once
#include <Client/Scene.hpp>

View File

@@ -49,6 +49,14 @@ namespace CaveGame::Client {
input_section->Title("Input");
}
bool GetOpen() const;
void SetOpen(bool value);
void Toggle();
void Open();
void Close();
protected:
JUI::Collapsible* general_section;
JUI::Collapsible* sound_section;

View File

@@ -1,5 +1,6 @@
#include <Client/GameSession.hpp>
#include <Core/Loggers.hpp>
#include <Client/SettingsMenu.hpp>
#include <JUI/Widgets/Rect.hpp>
#include <JUI/Widgets/ListLayout.hpp>
#include <JUI/UDim.hpp>
@@ -26,6 +27,9 @@ void CaveGame::Client::GameSession::Load() {
hud = new JUI::Scene();
pause_menu = new PauseMenuWidget(hud);
pause_menu->OnQuitButtonPressed += [this] (){ SaveAndExit();};
pause_menu->OnResumeButtonPressed += [this] () { pause_menu->Close(); };
pause_menu->OnSettingsButtonPressed += [this] () { Client::SettingsMenu::Instance().Open(); };
hotbar = TileHotbar();
// TODO: Redundant, use the constructor.

View File

@@ -10,11 +10,14 @@ namespace CaveGame::Client
this->ZIndex(1);
button_box = new JUI::Rect(this);
button_box->Size({150_px, 150_px});
button_box->Size({150_px, 170_px});
button_box->AnchorPoint({0.f, 1.f});
button_box->Position({50_px, 100_percent - 50_px});
button_box->BGColor(Colors::Transparent);
button_box->BorderWidth(0);
button_list = new JUI::VerticalListLayout(button_box);
button_list->PaddingBottom(5_px);
resume_btn = new JUI::TextButton(button_list);

View File

@@ -3,11 +3,8 @@
#include "Client/AssetService.hpp"
CaveGame::Client::Splash::Splash() : Scene()
{
//font = JGL::Font();
ComputeMatrixGlyphTable();
}
@@ -120,15 +117,9 @@ void CaveGame::Client::Splash::Update(float elapsed)
AssetService::Get()->LoadFromQueue();
load_percent = (float)AssetService::Get()->TotalLoaded() / (float)AssetService::Get()->TotalQueued();
//if (load_percent < 1)
//load_percent += elapsed/2.f;
//else
//load_percent = 1;
//splash_timer -= elapsed;
}
void CaveGame::Client::Splash::Load() {
@@ -137,7 +128,6 @@ void CaveGame::Client::Splash::Load() {
ComputeMatrixTextureCache();
Scene::Load();
}
void CaveGame::Client::Splash::Unload() {