4 * Created on: Aug 7, 2012
8 #ifndef GRAPHICS_FRAME_H_
9 #define GRAPHICS_FRAME_H_
11 #include "../geometry/Vector.h"
20 static const int TYPE_ID = 405;
23 explicit Frame(SDL_Surface *s = 0, int borderWidth = 1, int borderHeight = 1, int repeatWidth = 1, int repeatHeight = 1, int xOffset = 0, int yOffset = 0)
24 : surface(s), borderSize(borderWidth, borderHeight), repeatSize(repeatWidth, repeatHeight), offset(xOffset, yOffset) { }
27 int MinWidth() const { return 2 * BorderWidth(); }
28 int MinHeight() const { return 2 * BorderHeight(); }
29 int BorderWidth() const { return BorderSize().X(); }
30 int BorderHeight() const { return BorderSize().Y(); }
31 const geometry::Vector<int> BorderSize() const { return borderSize; }
32 int RepeatWidth() const { return RepeatSize().X(); }
33 int RepeatHeight() const { return RepeatSize().Y(); }
34 const geometry::Vector<int> RepeatSize() const { return repeatSize; }
35 void Draw(SDL_Surface *dest, const geometry::Vector<int> &position, int width, int height) const;
38 void SetSurface(SDL_Surface *s) { surface = s; }
39 void SetBorderSize(const geometry::Vector<int> &s) { borderSize = s; }
40 void SetRepeatSize(const geometry::Vector<int> &s) { repeatSize = s; }
41 void SetOffset(const geometry::Vector<int> &o) { offset = o; }
43 static void CreateTypeDescription();
44 static void Construct(void *);
48 geometry::Vector<int> borderSize;
49 geometry::Vector<int> repeatSize;
50 geometry::Vector<int> offset;
56 #endif /* GRAPHICS_FRAME_H_ */