X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FArea.h;h=5bdcf0121fdffeeedcc8d1a47b36081d6f493b29;hb=acc322b16b5f31cfbc350d4fccb457c7730287fd;hp=a044c8ba01a010866d617e4aa32ede2eeb8e4693;hpb=0ad5ca97b5df217329bc319d62564a9f46ba11d7;p=l2e.git diff --git a/src/map/Area.h b/src/map/Area.h index a044c8b..5bdcf01 100644 --- a/src/map/Area.h +++ b/src/map/Area.h @@ -1,38 +1,54 @@ -/* - * Area.h - * - * Created on: Sep 26, 2012 - * Author: holy - */ - #ifndef MAP_AREA_H_ #define MAP_AREA_H_ -#include "fwd.h" -#include "../geometry/Vector.h" -#include "../graphics/Sprite.h" +namespace graphics { + class Sprite; +} +namespace map { + class Tile; +} + +#include "../math/Vector.h" #include namespace map { +/// Defines a rectangular section of a map. +/// Tiles are rendered ltr with a row break each width tiles. +/// Missing tiles in the last row are possible but don't fool yourself. class Area { +public: + static const int TYPE_ID = 601; + public: Area(); ~Area() { } public: + /// Get the width in tiles. int Width() const { return width; } + /// Get the height in tiles. int Height() const { return numTiles / width + (numTiles % width ? 1 : 0); } - geometry::Vector Size() const { return geometry::Vector(Width(), Height()); } - Tile *TileAt(const geometry::Vector &); - const Tile *TileAt(const geometry::Vector &) const; + /// Get the size in tiles. + math::Vector Size() const { return math::Vector(Width(), Height()); } + /// Get a tile by tile coordinates (not pixel coordinates!). + Tile *TileAt(const math::Vector &); + const Tile *TileAt(const math::Vector &) const; + /// Get the default battle background for this area. SDL_Surface *BattleBackground() { return battlebg; } - void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const; - void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const; + void Render( + SDL_Surface *dest, + const graphics::Sprite *tileset, + const math::Vector &offset, + unsigned int frame) const; + void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const math::Vector &offset) const; + + static void CreateTypeDescription(); + static void Construct(void *); // temporary setters public: @@ -49,4 +65,4 @@ private: } -#endif /* MAP_AREA_H_ */ +#endif