summaryrefslogtreecommitdiffhomepage
path: root/GameScreen.cpp
diff options
context:
space:
mode:
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);
}