5 #include "../geometry/Vector.h"
6 #include "../graphics/Sprite.h"
12 /// Defines a rectangular section of a map.
13 /// Tiles are rendered ltr with a row break each width tiles.
14 /// Missing tiles in the last row are possible but don't fool yourself.
18 static const int TYPE_ID = 601;
25 /// Get the width in tiles.
26 int Width() const { return width; }
27 /// Get the height in tiles.
28 int Height() const { return numTiles / width + (numTiles % width ? 1 : 0); }
29 /// Get the size in tiles.
30 geometry::Vector<int> Size() const { return geometry::Vector<int>(Width(), Height()); }
31 /// Get a tile by tile coordinates (not pixel coordinates!).
32 Tile *TileAt(const geometry::Vector<int> &);
33 const Tile *TileAt(const geometry::Vector<int> &) const;
35 /// Get the default battle background for this area.
36 SDL_Surface *BattleBackground() { return battlebg; }
38 void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector<int> &offset) const;
39 void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector<int> &offset) const;
41 static void CreateTypeDescription();
42 static void Construct(void *);
46 void SetTiles(Tile *t, int num) { tiles = t; numTiles = num; }
47 void SetWidth(int w) { width = w; }
50 SDL_Surface *battlebg;
59 #endif /* MAP_AREA_H_ */