#include "Personnage.h" SDL_Rect operator+=(SDL_Rect &pos, Direction dir) { switch(dir) { case Arret: break; case Haut: pos.y -= 1; break; case Droite: pos.x += 1; break; case Bas: pos.y += 1; break; case Gauche: pos.x -= 1; break; } return pos; } void Personnage::afficher(SDL_Surface *ecran) { SDL_BlitSurface(m_skin, 0, ecran, &m_pos); } SDL_Rect Personnage::getPosition(bool coordonnee) { if(coordonnee) return m_pos; else { SDL_Rect pos; pos.x = m_pos.x+(m_skin->w-LG_BLOC)/2+LG_BLOC/2; pos.x /= LG_BLOC; pos.y = m_pos.y+(m_skin->h-LG_BLOC)/2+LG_BLOC/2; pos.y /= LG_BLOC; return pos; } } bool operator==(SDL_Rect pos1, SDL_Rect pos2) { if(pos1.x==pos2.x && pos1.y==pos2.y) return true; else return false; }