mirror of
https://github.com/Floriansylvain/SFMLplayground.git
synced 2026-08-19 11:43:24 +02:00
refac: moved draw & input code out of game class
This commit is contained in:
+2
-7
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user