X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FGauge.h;h=1eceadd6e85d0711de00c39e6c71c2273972aa66;hb=4309d259becd96ead792678257e910c03a6b4a3d;hp=95b4b5b580cf738cd2a22c7296a5819fac2561fa;hpb=cf20874f973521e84fc2aaa6cd47c56a278d9de7;p=l2e.git diff --git a/src/graphics/Gauge.h b/src/graphics/Gauge.h index 95b4b5b..1eceadd 100644 --- a/src/graphics/Gauge.h +++ b/src/graphics/Gauge.h @@ -1,14 +1,7 @@ -/* - * Gauge.h - * - * Created on: Aug 7, 2012 - * Author: holy - */ - #ifndef GRAPHICS_GAUGE_H_ #define GRAPHICS_GAUGE_H_ -#include "../geometry/Point.h" +#include "../math/Vector.h" #include @@ -16,21 +9,34 @@ namespace graphics { class Gauge { + public: + static const int TYPE_ID = 406; + public: - Gauge(SDL_Surface *s, int fullX, int fullY, int emptyX, int emptyY, int height, int startWidth, int repeatWidth, int endWidth) - : surface(s), fullX(fullX), fullY(fullY), emptyX(emptyX), emptyY(emptyY), height(height), startWidth(startWidth), repeatWidth(repeatWidth), endWidth(endWidth) { } + 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) + : surface(s), fullOffset(fullX, fullY), emptyOffset(emptyX, emptyY), height(height), startWidth(startWidth), repeatWidth(repeatWidth), endWidth(endWidth) { } public: int MinWidth() const { return startWidth + endWidth; } int Height() const { return height; } - void Draw(SDL_Surface *dest, geometry::Point position, int width, int filled) const; + void Draw(SDL_Surface *dest, const math::Vector &position, int width, Uint8 fill) const; + +public: + void SetSurface(SDL_Surface *s) { surface = s; } + void SetFullOffset(const math::Vector &o) { fullOffset = o; } + void SetEmptyOffset(const math::Vector &o) { emptyOffset = o; } + void SetHeight(int h) { height = h; } + void SetStartWidth(int w) { startWidth = w; } + void SetRepeatWidth(int w) { repeatWidth = w; } + void SetEndWidth(int w) { endWidth = w; } + + static void CreateTypeDescription(); + static void Construct(void *); private: SDL_Surface *surface; - int fullX; - int fullY; - int emptyX; - int emptyY; + math::Vector fullOffset; + math::Vector emptyOffset; int height; int startWidth; int repeatWidth; @@ -40,4 +46,4 @@ private: } -#endif /* GRAPHICS_GAUGE_H_ */ +#endif