X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FFrame.h;h=48331f01dda00913a7e22294053f88d8e2b749bd;hb=ce1e9a11c89c83356d797c8225369b711513a4da;hp=74ce1f7600e18198bf4ad5ed46a97df6b6d6860f;hpb=0542849dfccfec1ce1477265fa0fee2401a8fb23;p=l2e.git diff --git a/src/graphics/Frame.h b/src/graphics/Frame.h index 74ce1f7..48331f0 100644 --- a/src/graphics/Frame.h +++ b/src/graphics/Frame.h @@ -1,14 +1,7 @@ -/* - * Frame.h - * - * Created on: Aug 7, 2012 - * Author: holy - */ - #ifndef GRAPHICS_FRAME_H_ #define GRAPHICS_FRAME_H_ -#include "../geometry/Vector.h" +#include "../math/Vector.h" #include @@ -17,27 +10,40 @@ namespace graphics { class Frame { public: - Frame(SDL_Surface *s, int borderWidth, int borderHeight, int repeatWidth = 1, int repeatHeight = 1, int xOffset = 0, int yOffset = 0) - : surface(s), borderWidth(borderWidth), borderHeight(borderHeight), repeatWidth(repeatWidth), repeatHeight(repeatHeight), xOffset(xOffset), yOffset(yOffset) { } + static const int TYPE_ID = 405; + +public: + explicit Frame(SDL_Surface *s = 0, int borderWidth = 1, int borderHeight = 1, int repeatWidth = 1, int repeatHeight = 1, int xOffset = 0, int yOffset = 0) + : surface(s), borderSize(borderWidth, borderHeight), repeatSize(repeatWidth, repeatHeight), offset(xOffset, yOffset) { } public: - int MinWidth() const { return 2 * borderWidth; } - int MinHeight() const { return 2 * borderHeight; } - int BorderWidth() const { return borderWidth; } - int BorderHeight() const { return borderHeight; } - void Draw(SDL_Surface *dest, const geometry::Vector &position, int width, int height) const; + int MinWidth() const { return 2 * BorderWidth(); } + int MinHeight() const { return 2 * BorderHeight(); } + int BorderWidth() const { return BorderSize().X(); } + int BorderHeight() const { return BorderSize().Y(); } + const math::Vector BorderSize() const { return borderSize; } + int RepeatWidth() const { return RepeatSize().X(); } + int RepeatHeight() const { return RepeatSize().Y(); } + const math::Vector RepeatSize() const { return repeatSize; } + void Draw(SDL_Surface *dest, const math::Vector &position, int width, int height) const; + +public: + void SetSurface(SDL_Surface *s) { surface = s; } + void SetBorderSize(const math::Vector &s) { borderSize = s; } + void SetRepeatSize(const math::Vector &s) { repeatSize = s; } + void SetOffset(const math::Vector &o) { offset = o; } + + static void CreateTypeDescription(); + static void Construct(void *); private: SDL_Surface *surface; - int borderWidth; - int borderHeight; - int repeatWidth; - int repeatHeight; - int xOffset; - int yOffset; + math::Vector borderSize; + math::Vector repeatSize; + math::Vector offset; }; } -#endif /* GRAPHICS_FRAME_H_ */ +#endif