diff options
author | Aki <please@ignore.pl> | 2022-04-22 19:53:36 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-22 19:53:36 +0200 |
commit | 38df088b80cb6c159eb9941cf6d3c0a8492e65ee (patch) | |
tree | a0191edaa4f6ba9ba776180063db99a12da1d941 /OverScreen.cpp | |
parent | 804e71083e4df85c4f0692553de3084f0ed4cd9a (diff) | |
download | bullethell2022-38df088b80cb6c159eb9941cf6d3c0a8492e65ee.zip bullethell2022-38df088b80cb6c159eb9941cf6d3c0a8492e65ee.tar.gz bullethell2022-38df088b80cb6c159eb9941cf6d3c0a8492e65ee.tar.bz2 |
Added invulnerability timer and death screen
Diffstat (limited to 'OverScreen.cpp')
-rw-r--r-- | OverScreen.cpp | 36 |
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); +} |