]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Frame.h
added type description of Frame
[l2e.git] / src / graphics / Frame.h
1 /*
2  * Frame.h
3  *
4  *  Created on: Aug 7, 2012
5  *      Author: holy
6  */
7
8 #ifndef GRAPHICS_FRAME_H_
9 #define GRAPHICS_FRAME_H_
10
11 #include "../geometry/Vector.h"
12
13 #include <SDL.h>
14
15 namespace graphics {
16
17 class Frame {
18
19 public:
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) { }
22
23 public:
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;
33
34 public:
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; }
39
40         static void CreateTypeDescription();
41
42 private:
43         SDL_Surface *surface;
44         geometry::Vector<int> borderSize;
45         geometry::Vector<int> repeatSize;
46         geometry::Vector<int> offset;
47
48 };
49
50 }
51
52 #endif /* GRAPHICS_FRAME_H_ */