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.
29 /// Get the width in tiles.
30 int Width() const { return width; }
31 /// Get the height in tiles.
32 int Height() const { return numTiles / width + (numTiles % width ? 1 : 0); }
33 /// Get the size in tiles.
34 geometry::Vector<int> Size() const { return geometry::Vector<int>(Width(), Height()); }
35 /// Get a tile by tile coordinates (not pixel coordinates!).
36 Tile *TileAt(const geometry::Vector<int> &);
37 const Tile *TileAt(const geometry::Vector<int> &) const;
39 /// Get the default battle background for this area.
40 SDL_Surface *BattleBackground() { return battlebg; }
42 void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector<int> &offset) const;
43 void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector<int> &offset) const;
45 static void CreateTypeDescription();
46 static void Construct(void *);
50 void SetTiles(Tile *t, int num) { tiles = t; numTiles = num; }
51 void SetWidth(int w) { width = w; }
54 SDL_Surface *battlebg;
63 #endif /* MAP_AREA_H_ */