#include "GameScreen.h" #include #include "Bullets.h" GameScreen::GameScreen() : m_pos {400, 300}, m_const {} { } void GameScreen::update(const float dt) { if (IsKeyDown(KEY_LEFT)) m_pos.x -= dt * 80; if (IsKeyDown(KEY_RIGHT)) m_pos.x += dt * 80; m_generator.update(dt, m_const.m_bullets); m_const.update(dt); bool collided = false; for (const auto& bullet : m_const.m_bullets) { if (CheckCollisionCircles(m_pos, 9, bullet.position, bullet.radius)) collided = true; } (void) collided; } void GameScreen::draw() { DrawCircle(m_pos.x, m_pos.y, 10, LIGHTGRAY); m_const.draw(); DrawFPS(5, 5); DrawText(TextFormat("%d", m_const.m_bullets.size()), 5, 25, 20, DARKGRAY); }