refac: moved draw & input code out of game class

This commit is contained in:
Florian Sylvain
2025-05-11 01:01:18 +02:00
parent 874b54cf36
commit 885ed1ec4b
9 changed files with 217 additions and 161 deletions
+2 -7
View File
@@ -7,6 +7,7 @@
#include <vector>
#include "Ball.hpp"
#include "InputManager.hpp"
#include "PhysicalObject.hpp"
class Ball;
@@ -18,19 +19,13 @@ class Game {
sf::RenderWindow m_window;
std::vector<std::unique_ptr<PhysicalObject>> m_objects;
sf::Clock m_clock;
void processEvents();
InputManager m_inputManager;
void processKeyPressed(const sf::Event::KeyPressed& keyPressed);
void processMousePressed(const sf::Event::MouseButtonPressed& mousePressed);
void handleMouseClick(const sf::Vector2i& mousePos);
void update();
void render();
void drawLine(const sf::Vector2f& start, const sf::Vector2f& direction,
float length, const sf::Color& color);
void drawDirectionLine(const Ball* ball);
void drawVelocityLine(const Ball* ball);
public:
Game();
void run();