Déplacement des constantes d'unicité en haut de fichier

This commit is contained in:
Mattéo Delabre 2016-03-31 19:45:57 +02:00
parent 81434c9b7a
commit f5711cab70
4 changed files with 14 additions and 4 deletions

View File

@ -9,6 +9,11 @@ private:
mutable sf::Sprite sprite;
public:
/**
* Identifiant unique du type d'objet
*/
static const unsigned int TYPE_ID;
Block(float x, float y);
virtual ~Block();
@ -25,7 +30,6 @@ public:
/**
* Récupère l'identifiant de type de cet objet
*/
static const unsigned int TYPE_ID;
virtual unsigned int getTypeId() const;
};

View File

@ -16,6 +16,11 @@ protected:
virtual sf::Vector2f getForces(const Manager& manager, const std::vector<ObjectPtr>& objects) const;
public:
/**
* Identifiant unique du type d'objet
*/
static const unsigned int TYPE_ID;
Player(float x, float y);
virtual ~Player();
@ -32,7 +37,6 @@ public:
/**
* Récupère l'identifiant de type de cet objet
*/
static const unsigned int TYPE_ID;
virtual unsigned int getTypeId() const;
/**

View File

@ -3,6 +3,8 @@
#include "constants.hpp"
#include "resource_manager.hpp"
const unsigned int Block::TYPE_ID = 1;
Block::Block(float x, float y) : Object(x, y) {
// par défaut, les blocs ne sont pas déplaçables et ont
// donc une masse infinie, représentée par 0
@ -43,7 +45,6 @@ std::unique_ptr<sf::FloatRect> Block::getAABB() const {
));
}
const unsigned int Block::TYPE_ID = 1;
unsigned int Block::getTypeId() const {
return TYPE_ID;
}

View File

@ -4,6 +4,8 @@
#include <array>
#include <iostream>
const unsigned int Player::TYPE_ID = 0;
Player::Player(float x, float y) : Object(x, y) {
// déplacement de l'origine au centre de la balle
sprite.setOrigin(sf::Vector2f(getRadius(), getRadius()));
@ -60,7 +62,6 @@ std::unique_ptr<sf::FloatRect> Player::getAABB() const {
));
}
const unsigned int Player::TYPE_ID = 0;
unsigned int Player::getTypeId() const {
return TYPE_ID;
}