From 9793eb8817d22e947aef2e601c86b86d628c712c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Wed, 9 Mar 2016 20:01:15 +0100 Subject: [PATCH] Utilisation du constructeur parent dans Ball et Block --- ball.hpp | 3 +++ block.hpp | 3 +++ physics_object.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ball.hpp b/ball.hpp index 95c4c14..d8b3609 100644 --- a/ball.hpp +++ b/ball.hpp @@ -17,6 +17,9 @@ protected: static constexpr float MOVE = 10; public: + // utilise le constructeur de PhysicsObject + using PhysicsObject::PhysicsObject; + /** * Dessine la balle dans la fenêtre donnée */ diff --git a/block.hpp b/block.hpp index b5e7ac1..dc47dc4 100644 --- a/block.hpp +++ b/block.hpp @@ -8,6 +8,9 @@ class Block : public Object { public: + // utilise le constructeur de Object + using Object::Object; + /** * Dessin du bloc dans la fenêtre donnée */ diff --git a/physics_object.cpp b/physics_object.cpp index a829659..4d6217b 100644 --- a/physics_object.cpp +++ b/physics_object.cpp @@ -6,19 +6,19 @@ void PhysicsObject::update(State state) { // TODO: intégrer le vecteur force dans la vitesse puis la position } -sf::Vector2f getVelocity() { +sf::Vector2f PhysicsObject::getVelocity() { return velocity; } -void setVelocity(sf::Vector2f set_velocity) { +void PhysicsObject::setVelocity(sf::Vector2f set_velocity) { velocity = set_velocity; } -int getMass() { +int PhysicsObject::getMass() { return mass; } -void setMass(int set_mass) { +void PhysicsObject::setMass(int set_mass) { mass = set_mass; }