Affichable.cpp 418 B

1234567891011121314151617181920
  1. #include "Affichable.h"
  2. Affichable::Affichable(SDL_Surface* img)
  3. :m_img(img), m_pos(0.0f, 0.0f)
  4. {
  5. //ctor
  6. }
  7. Affichable::~Affichable()
  8. {
  9. //dtor
  10. }
  11. void Affichable::afficher(const Vec &lookAt, SDL_Surface* screen)
  12. {
  13. m_rect.x = m_pos.getX() - lookAt.getX() + screen->w/2 - m_img->w/2;
  14. m_rect.y = lookAt.getY() - m_pos.getY() + screen->h/2 - m_img->h/2;
  15. SDL_BlitSurface(m_img, 0, screen, &m_rect);
  16. }