X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FFrame.h;h=defa6b18ab303c175e66226e41969c1ff56a235d;hb=1907ca03c5e865c4d398170042aa384c67ffff29;hp=0f1287c06a3d2528b6f01c074ddda32f3c5ec75e;hpb=cccda573516f3bce30efbaba3fc20e4148d3cdc8;p=l2e.git diff --git a/src/graphics/Frame.h b/src/graphics/Frame.h index 0f1287c..defa6b1 100644 --- a/src/graphics/Frame.h +++ b/src/graphics/Frame.h @@ -8,7 +8,7 @@ #ifndef GRAPHICS_FRAME_H_ #define GRAPHICS_FRAME_H_ -#include "../geometry/Point.h" +#include "../geometry/Vector.h" #include @@ -17,22 +17,37 @@ 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: - int MinWidth() const { return 2 * borderWidth; } - int MinHeight() const { return 2 * borderHeight; } - void Draw(SDL_Surface *dest, geometry::Point position, int width, int height) const; + 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 BorderSize().X(); } + int BorderHeight() const { return BorderSize().Y(); } + const geometry::Vector BorderSize() const { return borderSize; } + int RepeatWidth() const { return RepeatSize().X(); } + int RepeatHeight() const { return RepeatSize().Y(); } + const geometry::Vector RepeatSize() const { return repeatSize; } + void Draw(SDL_Surface *dest, const geometry::Vector &position, int width, int height) const; + +public: + void SetSurface(SDL_Surface *s) { surface = s; } + void SetBorderSize(const geometry::Vector &s) { borderSize = s; } + void SetRepeatSize(const geometry::Vector &s) { repeatSize = s; } + void SetOffset(const geometry::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; + geometry::Vector borderSize; + geometry::Vector repeatSize; + geometry::Vector offset; };