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