From 88d53cab4e10aed6cdae443aa66136add99562bb Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 24 Apr 2022 23:51:27 +0200 Subject: Added some colorful stuff and interface --- Game.cpp | 1 - GameScreen.cpp | 5 +++++ OverScreen.cpp | 1 + TestStage.cpp | 6 ++++++ TitleScreen.cpp | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Game.cpp b/Game.cpp index 13790d5..a1b54ae 100644 --- a/Game.cpp +++ b/Game.cpp @@ -26,7 +26,6 @@ Game::update(const float dt) void Game::draw() { - ClearBackground(BLACK); if (m_screen) m_screen->draw(); } diff --git a/GameScreen.cpp b/GameScreen.cpp index 1a8795f..a5b4c6c 100644 --- a/GameScreen.cpp +++ b/GameScreen.cpp @@ -10,6 +10,9 @@ #include "Stage.h" +static constexpr Color INTERFACE {0, 0, 0, 230}; + + GameScreen::GameScreen(std::unique_ptr stage) : m_stage {std::move(stage)}, m_stats {std::make_shared()} @@ -31,6 +34,8 @@ void GameScreen::draw() { m_stage->draw(); + DrawRectangle(0, 0, 160, 600, INTERFACE); + DrawRectangle(800 - 160, 0, 160, 600, INTERFACE); DrawText(TextFormat("%d", m_stats->total_bullets), 5, 25, 20, DARKGRAY); DrawText(TextFormat("%d", m_stats->lifes), 5, 45, 20, DARKGREEN); DrawText(TextFormat("%d", m_stats->points), 5, 65, 20, GOLD); diff --git a/OverScreen.cpp b/OverScreen.cpp index 348e5a9..844a9dd 100644 --- a/OverScreen.cpp +++ b/OverScreen.cpp @@ -32,5 +32,6 @@ OverScreen::update(const float) void OverScreen::draw() { + ClearBackground(BLACK); DrawText(DIED, m_died_x, 160, 20, RED); } diff --git a/TestStage.cpp b/TestStage.cpp index e6ff74a..7dd5779 100644 --- a/TestStage.cpp +++ b/TestStage.cpp @@ -1,8 +1,13 @@ #include "TestStage.h" +#include + #include "EnemyFactory.h" +static constexpr Color DEEPSPACE {3, 5, 22, 255}; + + TestStage::TestStage() : m_player {}, m_const {} @@ -34,6 +39,7 @@ TestStage::update(const float dt) void TestStage::draw() { + ClearBackground(DEEPSPACE); m_const.draw(); for (auto& enemy : m_enemies) enemy.draw(); diff --git a/TitleScreen.cpp b/TitleScreen.cpp index 0bf52f8..ec590b1 100644 --- a/TitleScreen.cpp +++ b/TitleScreen.cpp @@ -39,6 +39,7 @@ TitleScreen::update(const float dt) void TitleScreen::draw() { + ClearBackground(BLACK); DrawText(TITLE, m_title_x, 160, FONT_SIZE, LIGHTGRAY); if (m_blink < INTERVAL) DrawText(PRESS, m_press_x, 180, FONT_SIZE, GRAY); -- cgit v1.1