Ajout d'une classe Object générale
This commit is contained in:
		
							parent
							
								
									623b4c2af7
								
							
						
					
					
						commit
						fdc38d411d
					
				|  | @ -0,0 +1,9 @@ | ||||||
|  | #include "object.hpp" | ||||||
|  | 
 | ||||||
|  | sf::Vector2f Object::getPosition() { | ||||||
|  |     return position; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int Object::getCharge() { | ||||||
|  |     return charge; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,29 @@ | ||||||
|  | #ifndef PTF_OBJECT_HPP | ||||||
|  | #define PTF_OBJECT_HPP | ||||||
|  | 
 | ||||||
|  | #include <SFML/Graphics.hpp> | ||||||
|  | #include <iostream> | ||||||
|  | 
 | ||||||
|  | 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 | ||||||
		Loading…
	
		Reference in New Issue