4 * Created on: Sep 26, 2012
12 #include "../geometry/Vector.h"
13 #include "../graphics/Sprite.h"
19 /// Defines a rectangular section of a map.
20 /// Tiles are rendered ltr with a row break each width tiles.
21 /// Missing tiles in the last row are possible but don't fool yourself.
25 static const int TYPE_ID = 601;
32 /// Get the width in tiles.
33 int Width() const { return width; }
34 /// Get the height in tiles.
35 int Height() const { return numTiles / width + (numTiles % width ? 1 : 0); }
36 /// Get the size in tiles.
37 geometry::Vector<int> Size() const { return geometry::Vector<int>(Width(), Height()); }
38 /// Get a tile by tile coordinates (not pixel coordinates!).
39 Tile *TileAt(const geometry::Vector<int> &);
40 const Tile *TileAt(const geometry::Vector<int> &) const;
42 /// Get the default battle background for this area.
43 SDL_Surface *BattleBackground() { return battlebg; }
45 void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector<int> &offset) const;
46 void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector<int> &offset) const;
48 static void CreateTypeDescription();
49 static void Construct(void *);
53 void SetTiles(Tile *t, int num) { tiles = t; numTiles = num; }
54 void SetWidth(int w) { width = w; }
57 SDL_Surface *battlebg;
66 #endif /* MAP_AREA_H_ */