]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Gauge.h
e4750ca6c14c187c471fef882b251097f5d90ab5
[l2e.git] / src / graphics / Gauge.h
1 /*
2  * Gauge.h
3  *
4  *  Created on: Aug 7, 2012
5  *      Author: holy
6  */
7
8 #ifndef GRAPHICS_GAUGE_H_
9 #define GRAPHICS_GAUGE_H_
10
11 #include "../geometry/Vector.h"
12
13 #include <SDL.h>
14
15 namespace graphics {
16
17 class Gauge {
18
19         public:
20                 static const int TYPE_ID = 406;
21
22 public:
23         explicit Gauge(SDL_Surface *s = 0, int fullX = 0, int fullY = 0, int emptyX = 0, int emptyY = 0, int height = 1, int startWidth = 0, int repeatWidth = 1, int endWidth = 0)
24         : surface(s), fullOffset(fullX, fullY), emptyOffset(emptyX, emptyY), height(height), startWidth(startWidth), repeatWidth(repeatWidth), endWidth(endWidth) { }
25
26 public:
27         int MinWidth() const { return startWidth + endWidth; }
28         int Height() const { return height; }
29         void Draw(SDL_Surface *dest, const geometry::Vector<int> &position, int width, Uint8 fill) const;
30
31 public:
32         void SetSurface(SDL_Surface *s) { surface = s; }
33         void SetFullOffset(const geometry::Vector<int> &o) { fullOffset = o; }
34         void SetEmptyOffset(const geometry::Vector<int> &o) { emptyOffset = o; }
35         void SetHeight(int h) { height = h; }
36         void SetStartWidth(int w) { startWidth = w; }
37         void SetRepeatWidth(int w) { repeatWidth = w; }
38         void SetEndWidth(int w) { endWidth = w; }
39
40         static void CreateTypeDescription();
41         static void Construct(void *);
42
43 private:
44         SDL_Surface *surface;
45         geometry::Vector<int> fullOffset;
46         geometry::Vector<int> emptyOffset;
47         int height;
48         int startWidth;
49         int repeatWidth;
50         int endWidth;
51
52 };
53
54 }
55
56 #endif /* GRAPHICS_GAUGE_H_ */