summaryrefslogtreecommitdiffhomepage
path: root/OverScreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'OverScreen.cpp')
-rw-r--r--OverScreen.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/OverScreen.cpp b/OverScreen.cpp
new file mode 100644
index 0000000..348e5a9
--- /dev/null
+++ b/OverScreen.cpp
@@ -0,0 +1,36 @@
+#include "OverScreen.h"
+
+#include <memory>
+
+#include <raylib.h>
+
+#include "Globals.h"
+#include "Stats.h"
+#include "TitleScreen.h"
+
+
+static constexpr const char* DIED {"The Bone is Gone"};
+
+
+OverScreen::OverScreen(std::shared_ptr<Stats> stats) :
+ m_stats {stats}
+{
+ const int screen_width = GetScreenWidth();
+ const int died_width = MeasureText(DIED, 20);
+ m_died_x = (screen_width - died_width) / 2;
+}
+
+
+void
+OverScreen::update(const float)
+{
+ if (IsKeyPressed(KEY_SPACE))
+ g_game.set(std::make_unique<TitleScreen>());
+}
+
+
+void
+OverScreen::draw()
+{
+ DrawText(DIED, m_died_x, 160, 20, RED);
+}