summaryrefslogtreecommitdiffhomepage
path: root/OverScreen.cpp
blob: 348e5a98ea0ad2ec4857dad476fbcbae2ecc4c8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
}