summaryrefslogtreecommitdiffhomepage
path: root/GameScreen.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-22 01:11:24 +0200
committerAki <please@ignore.pl>2022-04-22 01:11:24 +0200
commit804e71083e4df85c4f0692553de3084f0ed4cd9a (patch)
tree6cfdf65ee7de9c14984677ca4a607b27d9080e00 /GameScreen.cpp
parent7b8e199b0b6cccdf022bcd072bcdd8ab6c4072b1 (diff)
downloadbullethell2022-804e71083e4df85c4f0692553de3084f0ed4cd9a.zip
bullethell2022-804e71083e4df85c4f0692553de3084f0ed4cd9a.tar.gz
bullethell2022-804e71083e4df85c4f0692553de3084f0ed4cd9a.tar.bz2
Added Stats for lifes points and other kind of gameplay state
Diffstat (limited to 'GameScreen.cpp')
-rw-r--r--GameScreen.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/GameScreen.cpp b/GameScreen.cpp
index 02aab00..f813a60 100644
--- a/GameScreen.cpp
+++ b/GameScreen.cpp
@@ -9,25 +9,26 @@
GameScreen::GameScreen(std::unique_ptr<Stage> stage) :
- m_stage {std::move(stage)}
+ m_stage {std::move(stage)},
+ m_stats {std::make_shared<Stats>()}
{
+ m_stage->m_stats = m_stats;
}
void
GameScreen::update(const float dt)
{
- if (m_stage)
- m_stage->update(dt);
+ m_stage->update(dt);
}
void
GameScreen::draw()
{
- if (m_stage) {
- m_stage->draw();
- DrawText(TextFormat("%d", m_stage->total_bullets()), 5, 25, 20, DARKGRAY);
- }
+ m_stage->draw();
+ DrawText(TextFormat("%d", m_stats->total_bullets), 5, 25, 20, DARKGRAY);
+ DrawText(TextFormat("%d", m_stats->lifes), 5, 45, 20, DARKGREEN);
+ DrawText(TextFormat("%d", m_stats->points), 5, 65, 20, GOLD);
DrawFPS(5, 5);
}