summaryrefslogtreecommitdiffhomepage
path: root/OverScreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'OverScreen.cpp')
-rw-r--r--OverScreen.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/OverScreen.cpp b/OverScreen.cpp
index dcf5866..a465464 100644
--- a/OverScreen.cpp
+++ b/OverScreen.cpp
@@ -9,7 +9,11 @@
#include "TitleScreen.h"
-static constexpr const char* DIED {"The Bone is Gone"};
+static constexpr const char* DIED {"Game Over"};
+static constexpr const char* LABEL {"Your Score: "};
+
+
+static const char* points_text(std::shared_ptr<Stats> stats);
OverScreen::OverScreen(std::shared_ptr<Stats> stats) :
@@ -17,7 +21,12 @@ OverScreen::OverScreen(std::shared_ptr<Stats> stats) :
{
const int screen_width = GetScreenWidth();
const int died_width = MeasureText(DIED, 20);
+ const int label_width = MeasureText(LABEL, 20);
+ const int score_width = MeasureText(points_text(m_stats), 20);
+ const int label_and_score = label_width + score_width;
m_died_x = (screen_width - died_width) / 2;
+ m_label_x = (screen_width - label_and_score) / 2;
+ m_score_x = m_label_x + label_width;
m_flash.start();
}
@@ -36,5 +45,16 @@ OverScreen::draw()
{
ClearBackground(BLACK);
DrawText(DIED, m_died_x, 160, 20, RED);
+ DrawText(LABEL, m_label_x, 180, 20, GRAY);
+ DrawText(points_text(m_stats), m_score_x, 180, 20, GOLD);
m_flash.draw();
}
+
+
+const char*
+points_text(std::shared_ptr<Stats> stats)
+{
+ if (stats->lifes > 0)
+ return TextFormat("%d + %d", stats->points, 1000 * stats->lifes);
+ return TextFormat("%d", stats->points);
+}