From fdc38d411d001e3113d48d3e8b86222808c05f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Tue, 8 Mar 2016 18:07:09 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=20classe=20Object=20g=C3=A9n?= =?UTF-8?q?=C3=A9rale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- object.cpp | 9 +++++++++ object.hpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 object.cpp create mode 100644 object.hpp diff --git a/object.cpp b/object.cpp new file mode 100644 index 0000000..614a8ae --- /dev/null +++ b/object.cpp @@ -0,0 +1,9 @@ +#include "object.hpp" + +sf::Vector2f Object::getPosition() { + return position; +} + +int Object::getCharge() { + return charge; +} diff --git a/object.hpp b/object.hpp new file mode 100644 index 0000000..02f721d --- /dev/null +++ b/object.hpp @@ -0,0 +1,29 @@ +#ifndef PTF_OBJECT_HPP +#define PTF_OBJECT_HPP + +#include +#include + +class Object { +protected: + sf::Vector2f position; + int charge; + +public: + /** + * Dessine l'objet dans la fenêtre donnée + */ + virtual void draw(sf::RenderWindow& window) = 0; + + /** + * Récupère la position de l'objet + */ + sf::Vector2f getPosition(); + + /** + * Récupère la charge de l'objet + */ + int getCharge(); +}; + +#endif