-/*
- * Map.h
- *
- * Created on: Sep 29, 2012
- * Author: holy
- */
-
#ifndef MAP_MAP_H_
#define MAP_MAP_H_
+namespace map {
+ class Area;
+ class Tile;
+ class Trigger;
+}
+namespace math {
+ template<class>
+ class Vector;
+}
+
#include "Entity.h"
-#include "fwd.h"
-#include "../geometry/Vector.h"
-#include "../graphics/fwd.h"
#include <SDL.h>
/// Maps are made up of uniform areas of tiles.
/// The looks of a tile is defined by the Tileset() sprite with Tile::Offset()
/// as the column and row in the sprite.
-/// Maps can be propulated with triggers and entities. Those are or use with
-/// MapState and are not handled by the map itself.
+/// Maps can be propulated with triggers and entities. Those are for use with
+/// a MapState and are not handled by the map itself.
/// Positions are expressed either as pixel or tile coordinates depending on
/// function purpose with (0|0) being the top left corner and positive values
/// extending to the right and down respectively.
/// The sprite used as the tileset.
const graphics::Sprite *Tileset() const { return tileset; }
/// Returns the Area at given pixel coordinates or 0 if off the map.
- Area *AreaAt(const geometry::Vector<int> &);
- const Area *AreaAt(const geometry::Vector<int> &) const;
+ Area *AreaAt(const math::Vector<int> &);
+ const Area *AreaAt(const math::Vector<int> &) const;
/// Returns the Tile at given pixel coordinates or 0 if off the map.
- Tile *TileAt(const geometry::Vector<int> &);
- const Tile *TileAt(const geometry::Vector<int> &) const;
+ Tile *TileAt(const math::Vector<int> &);
+ const Tile *TileAt(const math::Vector<int> &) const;
/// Returns the Trigger at given pixel coordinates or 0 if off the map.
/// Multiple triggers are not supported. The first one found is returned.
- Trigger *TriggerAt(const geometry::Vector<int> &);
+ Trigger *TriggerAt(const math::Vector<int> &);
/// The battle background image for this map if neither the tile nor the
/// area has one specified.
- SDL_Surface *BattleBackgroundAt(const geometry::Vector<int> &);
- /// Convert coordinates pixel to tile.
- geometry::Vector<int> TileCoordinates(const geometry::Vector<int> &) const;
+ SDL_Surface *BattleBackgroundAt(const math::Vector<int> &);
+ /// Convert coordinates from pixel to tile.
+ math::Vector<int> TileCoordinates(const math::Vector<int> &) const;
+ /// Convert coordinates from tile to pixel.
+ math::Vector<int> PixelCoordinates(const math::Vector<int> &) const;
Entity *EntitiesBegin() { return entities; }
Entity *EntitiesEnd() { return entities + numEntities; }
/// Render the map.
/// Entities are not rendered by this function.
- void Render(SDL_Surface *dest, const geometry::Vector<int> &offset) const;
+ void Render(
+ SDL_Surface *dest,
+ const math::Vector<int> &offset,
+ unsigned int frame) const;
/// Render a debugging overlay that includes collision and trigger
/// information.
- void RenderDebug(SDL_Surface *dest, const geometry::Vector<int> &offset) const;
+ void RenderDebug(SDL_Surface *dest, const math::Vector<int> &offset) const;
static void CreateTypeDescription();
static void Construct(void *);
}
-#endif /* MAP_MAP_H_ */
+#endif