/*
* TileManager.h
*
* Created on: 08.08.2012
* Author: Felix
*/
#ifndef DG_TILEMANAGER_H_
#define DG_TILEMANAGER_H_
#include <map>
#include <vector>
#include "../World.h"
#include "../abstract/Sprite.h"
#include "../types/Vector.h"
#include "../types/String.h"
class World;
class Sprite;
class TileManager : public sf::Drawable {
// Public types.
public:
enum class Type {
FLOOR,
WALL
};
/**
* Uses the length/width of a tile as a unit.
typedef Vector2i TilePosition;
// Public variables.
/// The size of a single tile (pixels).
static const Vector2i TILE_SIZE;
// Public functions.
TileManager(World& world);
void setTile(const TilePosition& position, Type type);
// Private types.
private:
class Tile;
// Private functions.
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
// Private variables.
World& mWorld;
std::vector<std::shared_ptr<Tile> > mTiles;
* Holds information about a single tile.
class TileManager::Tile : public Sprite {
Tile(Type type, const TilePosition& position);
Type getType() const;
TilePosition getTilePosition() const;
static String getConfig(Type type);
Type mType;
#endif /* DG_TILEMANAGER_H_ */