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