]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Frame.h
added Frame class for drawing bordered windows
[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/Point.h"
12
13 #include <SDL.h>
14
15 namespace graphics {
16
17 class Frame {
18
19 public:
20         Frame(SDL_Surface *s, int borderWidth, int borderHeight, int repeatWidth = 1, int repeatHeight = 1, int xOffset = 0, int yOffset = 0)
21         : surface(s), borderWidth(borderWidth), borderHeight(borderHeight), repeatWidth(repeatWidth), repeatHeight(repeatHeight), xOffset(xOffset), yOffset(yOffset) { }
22
23 public:
24         int MinWidth() const { return 2 * borderWidth; }
25         int MinHeight() const { return 2 * borderHeight; }
26         void Draw(SDL_Surface *dest, geometry::Point<int> position, int width, int height) const;
27
28 private:
29         SDL_Surface *surface;
30         int borderWidth;
31         int borderHeight;
32         int repeatWidth;
33         int repeatHeight;
34         int xOffset;
35         int yOffset;
36
37 };
38
39 }
40
41 #endif /* GRAPHICS_FRAME_H_ */