From 4a8b31816b897187f6168b8af20f9906772c9976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Mon, 14 Mar 2016 21:43:27 +0100 Subject: [PATCH] Transformation de la charge en float --- include/object.hpp | 6 +++--- src/main.cpp | 6 +++--- src/object.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/object.hpp b/include/object.hpp index bbd3961..175435e 100644 --- a/include/object.hpp +++ b/include/object.hpp @@ -8,7 +8,7 @@ class Object { protected: sf::Vector2f position; - int charge; + float charge; int layer; public: @@ -48,12 +48,12 @@ public: /** * Récupère la charge de l'objet */ - int getCharge(); + float getCharge(); /** * Modifie la charge de l'objet */ - void setCharge(int set_charge); + void setCharge(float set_charge); }; /** diff --git a/src/main.cpp b/src/main.cpp index 19bf608..8308508 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,9 +20,9 @@ int main() { Block block8(9 * Constants::GRID, 7 * Constants::GRID); Block block9(10 * Constants::GRID, 7 * Constants::GRID); - ball1.setCharge(-2); - ball2.setCharge(-2); - block5.setCharge(16); + ball1.setCharge(-2.f); + ball2.setCharge(-2.f); + block5.setCharge(16.f); engine.addObject(ball1); engine.addObject(ball2); diff --git a/src/object.cpp b/src/object.cpp index 0b54b50..a7af51b 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -1,6 +1,6 @@ #include "object.hpp" -Object::Object(float x, float y) : position(x, y), charge(0), layer(10) {} +Object::Object(float x, float y) : position(x, y), charge(0.f), layer(10) {} sf::Vector2f Object::getPosition() { return position; @@ -14,11 +14,11 @@ void Object::setLayer(unsigned int set_layer) { layer = set_layer; } -int Object::getCharge() { +float Object::getCharge() { return charge; } -void Object::setCharge(int set_charge) { +void Object::setCharge(float set_charge) { charge = set_charge; }