cs381/as6/scene/DeathScene.cpp

34 lines
1.0 KiB
C++

#include "scene/DeathScene.hpp"
#include "EnergyBarRaygui.hpp"
#include "scene/GameplayScene.hpp"
#include "scene/SceneManager.hpp"
#include "scene/StartMenuScene.hpp"
void DeathScene::Update(float) {
if (IsKeyPressed(KEY_ENTER)) {
manager.QueueSceneChange<GameplayScene>(this->isMuted);
return;
}
if (IsKeyPressed(KEY_ESCAPE)) {
manager.QueueSceneChange<StartMenuScene>(this->isMuted);
}
}
void DeathScene::Draw() {
Scene::Draw();
// Draw centered death stats using the HUD helper
// collectedStars is a private member; access via this-> to satisfy older compilers / linters
DrawDeathStats(this->collectedStars);
if (GuiButton((Rectangle){WINDOW_WIDTH / 2 - 150, WINDOW_HEIGHT / 2 + 28, 300, 20},
"Main Menu")) {
manager.QueueSceneChange<StartMenuScene>(this->isMuted);
}
if (GuiButton((Rectangle){WINDOW_WIDTH / 2 - 150, WINDOW_HEIGHT / 2 + 60, 300, 20}, "Retry")) {
manager.QueueSceneChange<GameplayScene>(this->isMuted);
}
}