summaryrefslogtreecommitdiffhomepage
path: root/GameScreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'GameScreen.cpp')
-rw-r--r--GameScreen.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/GameScreen.cpp b/GameScreen.cpp
index 4315060..02aab00 100644
--- a/GameScreen.cpp
+++ b/GameScreen.cpp
@@ -1,11 +1,15 @@
#include "GameScreen.h"
+#include <memory>
+#include <utility>
+
#include <raylib.h>
+#include "Stage.h"
+
-GameScreen::GameScreen() :
- m_const {},
- m_generator {m_const.m_bullets}
+GameScreen::GameScreen(std::unique_ptr<Stage> stage) :
+ m_stage {std::move(stage)}
{
}
@@ -13,19 +17,17 @@ GameScreen::GameScreen() :
void
GameScreen::update(const float dt)
{
- m_player.update(dt);
- m_generator.update(dt);
- m_const.update(dt);
- bool collided = m_player.collide(m_const.m_bullets);
- (void) collided;
+ if (m_stage)
+ m_stage->update(dt);
}
void
GameScreen::draw()
{
- m_const.draw();
- m_player.draw();
+ if (m_stage) {
+ m_stage->draw();
+ DrawText(TextFormat("%d", m_stage->total_bullets()), 5, 25, 20, DARKGRAY);
+ }
DrawFPS(5, 5);
- DrawText(TextFormat("%d", m_const.m_bullets.size()), 5, 25, 20, DARKGRAY);
}