Personnage.h 952 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef PERSONNAGE_H_INCLUDED
  2. #define PERSONNAGE_H_INCLUDED
  3. #include <iostream>
  4. #include <SDL/SDL.h>
  5. #undef main
  6. #include <SDL/SDL_image.h>
  7. #include "Niveau.h"
  8. #include <vector>
  9. #include <cstdlib>
  10. #include <cmath>
  11. enum Direction {Arret = 0, Haut = 1, Droite = 2, Bas = 4, Gauche = 8};
  12. enum Controle {local, ordi, distant};
  13. //static int vitesse = 1;// pour changer l'incrementation du a l'operateur +=
  14. SDL_Rect operator+=(SDL_Rect &pos, Direction dir);
  15. bool operator==(SDL_Rect pos1, SDL_Rect pos2);
  16. class Personnage
  17. {
  18. public:
  19. virtual ~Personnage(){}
  20. virtual void deplacer() = 0;
  21. virtual void positionner(SDL_Rect position, bool coordonnee = false) = 0;// pos[0] -> x, pos[1] -> y
  22. virtual void afficher(SDL_Surface *ecran);
  23. virtual SDL_Rect getPosition(bool coordonnee = 0);
  24. protected:
  25. SDL_Rect m_pos;
  26. Direction m_direction, m_nouvDir;
  27. SDL_Surface *m_skin;
  28. Niveau *m_terrain;
  29. };
  30. #endif // PERSONNAGE_H_INCLUDED