From 63c64254a80564e11987ba4af289cf8d47774668 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 25 Apr 2022 00:18:36 +0200 Subject: Added move constraints --- GameScreen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'GameScreen.cpp') diff --git a/GameScreen.cpp b/GameScreen.cpp index a5b4c6c..aeda96b 100644 --- a/GameScreen.cpp +++ b/GameScreen.cpp @@ -11,12 +11,15 @@ static constexpr Color INTERFACE {0, 0, 0, 230}; +static constexpr float BAR_WIDTH {160}; GameScreen::GameScreen(std::unique_ptr stage) : m_stage {std::move(stage)}, m_stats {std::make_shared()} { + m_stage->m_player.m_playground = Rectangle{ + BAR_WIDTH, 0, GetScreenWidth() - 2 * BAR_WIDTH, static_cast(GetScreenHeight())}; m_stage->m_stats = m_stats; } @@ -34,8 +37,8 @@ void GameScreen::draw() { m_stage->draw(); - DrawRectangle(0, 0, 160, 600, INTERFACE); - DrawRectangle(800 - 160, 0, 160, 600, INTERFACE); + DrawRectangle(0, 0, BAR_WIDTH, 600, INTERFACE); + DrawRectangle(800 - BAR_WIDTH, 0, BAR_WIDTH, 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); -- cgit v1.1