4 * Created on: Aug 5, 2012
8 #ifndef GRAPHICS_SPRITE_H_
9 #define GRAPHICS_SPRITE_H_
11 #include "../geometry/operators.h"
12 #include "../geometry/Point.h"
13 #include "../geometry/Vector.h"
22 Sprite(SDL_Surface *s, int width, int height, int xOffset = 0, int yOffset = 0)
23 : surface(s), width(width), height(height), xOffset(xOffset), yOffset(yOffset) { }
26 int Width() const { return width; }
27 int Height() const { return height; }
28 void Draw(SDL_Surface *dest, const geometry::Point<int> &position, int col = 0, int row = 0) const;
29 void DrawTopRight(SDL_Surface *dest, const geometry::Point<int> &position, int col = 0, int row = 0) const {
30 geometry::Vector<int> offset(-Width(), 0);
31 Draw(dest, position + offset, col, row);
33 void DrawCenter(SDL_Surface *dest, const geometry::Point<int> &position, int col = 0, int row = 0) const {
34 geometry::Vector<int> offset(-Width() / 2, -Height() / 2);
35 Draw(dest, position + offset, col, row);
37 void DrawCenterBottom(SDL_Surface *dest, const geometry::Point<int> &position, int col = 0, int row = 0) const {
38 geometry::Vector<int> offset(-Width() / 2, -Height());
39 Draw(dest, position + offset, col, row);
53 #endif /* GRAPHICS_SPRITE_H_ */