summaryrefslogtreecommitdiffhomepage
path: root/TitleScreen.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-17 11:04:00 +0200
committerAki <please@ignore.pl>2022-04-17 11:04:00 +0200
commita0705fcd7b51401b45ff9960a81c08520f142230 (patch)
tree575d16a2b37d0fe674979519fcd70489c720e0fb /TitleScreen.cpp
parent5209d9f8771ea765ebcadf89d18a6dbd1398dd12 (diff)
downloadbullethell2022-a0705fcd7b51401b45ff9960a81c08520f142230.zip
bullethell2022-a0705fcd7b51401b45ff9960a81c08520f142230.tar.gz
bullethell2022-a0705fcd7b51401b45ff9960a81c08520f142230.tar.bz2
Added some details to title screen
Diffstat (limited to 'TitleScreen.cpp')
-rw-r--r--TitleScreen.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/TitleScreen.cpp b/TitleScreen.cpp
index d109003..9bdd47c 100644
--- a/TitleScreen.cpp
+++ b/TitleScreen.cpp
@@ -10,10 +10,27 @@
extern Game g_game;
+static constexpr const char* TITLE {"Generic Bullet HELL"};
+static constexpr const char* PRESS {"Press SPACE to start"};
+
+
+TitleScreen::TitleScreen() :
+ m_blink {0}
+{
+ const int screen_width = GetScreenWidth();
+ const int title_width = MeasureText(TITLE, FONT_SIZE);
+ const int press_width = MeasureText(PRESS, FONT_SIZE);
+ m_title_x = (screen_width - title_width) / 2;
+ m_press_x = (screen_width - press_width) / 2;
+}
+
void
TitleScreen::update(const float dt)
{
+ m_blink += dt;
+ if (m_blink > 2 * INTERVAL)
+ m_blink -= 2 * INTERVAL;
if (IsKeyPressed(KEY_SPACE))
g_game.set(std::make_unique<GameScreen>());
}
@@ -22,5 +39,7 @@ TitleScreen::update(const float dt)
void
TitleScreen::draw()
{
- DrawText("Bullet HELL 2022", 190, 200, 20, LIGHTGRAY);
+ DrawText(TITLE, m_title_x, 160, FONT_SIZE, LIGHTGRAY);
+ if (m_blink < INTERVAL)
+ DrawText(PRESS, m_press_x, 180, FONT_SIZE, GRAY);
}