cs381/as6/scene/DeathScene.cpp

35 lines
1007 B
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>();
return;
}
if (IsKeyPressed(KEY_ESCAPE)) {
manager.QueueSceneChange<StartMenuScene>();
}
}
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>();
}
if (GuiButton((Rectangle){WINDOW_WIDTH / 2 - 150, WINDOW_HEIGHT / 2 + 60, 300, 20},
"Retry")) {
manager.QueueSceneChange<GameplayScene>();
}
}