diff --git a/ball.cpp b/ball.cpp index 7e430dc..d7a253d 100644 --- a/ball.cpp +++ b/ball.cpp @@ -1,7 +1,8 @@ #include "ball.hpp" void Ball::draw(sf::RenderWindow& window) { - // TODO: implémenter cette fonction + shape.setPosition(position); + window.draw(shape); } sf::Vector2f Ball::getForces(State state) { diff --git a/ball.hpp b/ball.hpp index d8b3609..5388f9d 100644 --- a/ball.hpp +++ b/ball.hpp @@ -8,6 +8,8 @@ class Ball : public PhysicsObject { protected: + sf::CircleShape shape; + /** * Calcule les forces appliquées à l'objet */ @@ -17,8 +19,9 @@ protected: static constexpr float MOVE = 10; public: - // utilise le constructeur de PhysicsObject - using PhysicsObject::PhysicsObject; + Ball(float x, float y) : PhysicsObject(x, y), shape(10 * mass) { + shape.setFillColor(sf::Color(150,255,20)); + } /** * Dessine la balle dans la fenêtre donnée diff --git a/block.hpp b/block.hpp index dc47dc4..35a2049 100644 --- a/block.hpp +++ b/block.hpp @@ -7,7 +7,14 @@ #include "state.hpp" class Block : public Object { +protected: + sf::CircleShape shape; + public: + Block(float x, float y) : Object(x,y), shape(80,4) { + shape.setFillColor(sf::Color(0,0,0)); + } + // utilise le constructeur de Object using Object::Object; diff --git a/build/ball.o b/build/ball.o index 5105a2d..ec91840 100644 Binary files a/build/ball.o and b/build/ball.o differ diff --git a/build/engine.o b/build/engine.o index ad653dc..c9298b6 100644 Binary files a/build/engine.o and b/build/engine.o differ diff --git a/build/main.o b/build/main.o index 54d6cd3..750bca3 100644 Binary files a/build/main.o and b/build/main.o differ diff --git a/build/object.o b/build/object.o index 9b935a9..3c36253 100644 Binary files a/build/object.o and b/build/object.o differ diff --git a/build/physics_object.o b/build/physics_object.o index 49bdf37..d513dc6 100644 Binary files a/build/physics_object.o and b/build/physics_object.o differ diff --git a/build/ptf b/build/ptf index 4c56967..91c6b84 100755 Binary files a/build/ptf and b/build/ptf differ