Skip to content
This repository
tree: 639b0c00dd
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 57 lines (46 sloc) 1.353 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#include <Sprite.h>

#include <Constants.h>
#include <Console.h>
#include <Game.h>
#include <Level.h>


namespace Polukili
{
   /*************************************************/
   Sprite::Sprite(GRRLIB_texImg* image, int width, int height)
      : image(image), x(0), y(0), referenceX(0), referenceY(0), factor(1), angle(0)
   {
      Console::log(LOG_INFO, "new Sprite");
   }
   
   /*************************************************/
   Sprite::~Sprite()
   {
      Console::log(LOG_INFO, "will destroy sprite");
   }
   
   /*************************************************/
   void Sprite::draw()
   {
      GRRLIB_DrawImg(this->x - this->referenceX, this->y - this->referenceY, this->image, this->angle, this->factor, this->factor, 0xFFFFFFFF);
   }

   /*************************************************/
   void Sprite::setPosition(int x, int y)
   {
      this->x = x;
      this->y = y;
   }

   /*************************************************/
   void Sprite::setReferencePosition(int x, int y)
   {
      this->referenceX = x;
      this->referenceY = y;
   }

   /*************************************************/
   void Sprite::setZoom(float factor)
   {
      this->factor = factor;
   }
   
   /*************************************************/
   void Sprite::setRotation(float angle)
   {
      this->angle = angle;
   }
}

Something went wrong with that request. Please try again.