Le layer est désormais une variable de la classe
This commit is contained in:
		
							parent
							
								
									ea42340ab3
								
							
						
					
					
						commit
						7e9ebdda9f
					
				|  | @ -28,11 +28,6 @@ public: | |||
|      * Récupère la boîte englobante de l'objet | ||||
|      */ | ||||
|     std::unique_ptr<sf::FloatRect> getAABB(); | ||||
| 
 | ||||
|     /**
 | ||||
|      * Détermine la couche d'affichage de l'objet | ||||
|      */ | ||||
|     unsigned int getLayer(); | ||||
| }; | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -29,11 +29,6 @@ public: | |||
|      * Récupère la boîte englobante de l'objet | ||||
|      */ | ||||
|     std::unique_ptr<sf::FloatRect> getAABB(); | ||||
| 
 | ||||
|     /**
 | ||||
|      * Détermine la couche d'affichage de l'objet | ||||
|      */ | ||||
|     unsigned int getLayer(); | ||||
| }; | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ class Object { | |||
| protected: | ||||
|     sf::Vector2f position; | ||||
|     int charge; | ||||
|     int layer; | ||||
| 
 | ||||
| public: | ||||
|     Object(float x, float y); | ||||
|  | @ -29,16 +30,21 @@ public: | |||
|      */ | ||||
|     virtual std::unique_ptr<sf::FloatRect> getAABB() = 0; | ||||
| 
 | ||||
|     /**
 | ||||
|      * Détermine la couche d'affichage de l'objet | ||||
|      */ | ||||
|     virtual unsigned int getLayer() = 0; | ||||
| 
 | ||||
|     /**
 | ||||
|      * Récupère la position de l'objet | ||||
|      */ | ||||
|     sf::Vector2f getPosition(); | ||||
| 
 | ||||
|     /**
 | ||||
|      * Récupère la couche d'affichage de l'objet | ||||
|      */ | ||||
|     unsigned int getLayer(); | ||||
| 
 | ||||
|     /**
 | ||||
|      * Modifie la couche d'affichage de l'objet | ||||
|      */ | ||||
|     void setLayer(unsigned int set_layer); | ||||
| 
 | ||||
|     /**
 | ||||
|      * Récupère la charge de l'objet | ||||
|      */ | ||||
|  |  | |||
|  | @ -27,10 +27,6 @@ std::unique_ptr<sf::FloatRect> Ball::getAABB() { | |||
|     )); | ||||
| } | ||||
| 
 | ||||
| unsigned int Ball::getLayer() { | ||||
|     return 10; | ||||
| } | ||||
| 
 | ||||
| sf::Vector2f Ball::getForces(EngineState& state) { | ||||
|     sf::Vector2f forces = PhysicsObject::getForces(state); | ||||
| 
 | ||||
|  |  | |||
|  | @ -36,7 +36,3 @@ std::unique_ptr<sf::FloatRect> Block::getAABB() { | |||
|         Constants::GRID, Constants::GRID | ||||
|     )); | ||||
| } | ||||
| 
 | ||||
| unsigned int Block::getLayer() { | ||||
|     return 10; | ||||
| } | ||||
|  |  | |||
|  | @ -1,11 +1,19 @@ | |||
| #include "object.hpp" | ||||
| 
 | ||||
| Object::Object(float x, float y) : position(x, y), charge(0) {} | ||||
| Object::Object(float x, float y) : position(x, y), charge(0), layer(10) {} | ||||
| 
 | ||||
| sf::Vector2f Object::getPosition() { | ||||
|     return position; | ||||
| } | ||||
| 
 | ||||
| unsigned int Object::getLayer() { | ||||
|     return layer; | ||||
| } | ||||
| 
 | ||||
| void Object::setLayer(unsigned int set_layer) { | ||||
|     layer = set_layer; | ||||
| } | ||||
| 
 | ||||
| int Object::getCharge() { | ||||
|     return charge; | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue