4 * Created on: Aug 5, 2012
8 #ifndef GRAPHICS_SPRITE_H_
9 #define GRAPHICS_SPRITE_H_
11 #include "../geometry/Vector.h"
20 Sprite(SDL_Surface *s, int width, int height, int xOffset = 0, int yOffset = 0)
21 : surface(s), width(width), height(height), xOffset(xOffset), yOffset(yOffset) { }
24 int Width() const { return width; }
25 int Height() const { return height; }
26 void Draw(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const;
27 void DrawTopRight(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const {
28 geometry::Vector<int> offset(-Width(), 0);
29 Draw(dest, position + offset, col, row);
31 void DrawCenter(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const {
32 geometry::Vector<int> offset(-Width() / 2, -Height() / 2);
33 Draw(dest, position + offset, col, row);
35 void DrawCenterBottom(SDL_Surface *dest, const geometry::Vector<int> &position, int col = 0, int row = 0) const {
36 geometry::Vector<int> offset(-Width() / 2, -Height());
37 Draw(dest, position + offset, col, row);
51 #endif /* GRAPHICS_SPRITE_H_ */