Dauphine  0.1
A platforming/stealth game in a medieval fantasy setting, developed with SDL2.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TileMap Class Reference

Represents the tile distrubution for a level. More...

#include <TileMap.h>

Public Member Functions

 TileMap (const std::string &mapPath_)
 The constructor. More...
 
 ~TileMap ()
 The destructor.
 
void render (const double cameraX_, const double cameraY_)
 Renders the TileMap. More...
 
unsigned int getMapWidth ()
 
unsigned int getMapHeight ()
 
std::vector< SDL_Rect > & getCollisionRects ()
 
std::vector< std::vector< int > > & operator[] (int i)
 Returns a reference to the tile index at #x #y #z.
 

Private Member Functions

void load (const std::string &mapPath_)
 
void addTileSet (const std::string &path_)
 
void renderLayer (const double cameraX_, const double cameraY_, const unsigned int layer_)
 Renders a certain layer from the TileMap. More...
 

Private Attributes

Tmx::Map * map
 
unsigned int layers
 
unsigned int mapWidth
 
unsigned int mapHeight
 
std::vector< std::vector
< std::vector< int > > > 
tileMatrix
 
                      Three-dimensional

matrix, that contains x = width, y = height, z = layers

 
std::vector< Sprite * > tilesetSprites
 
std::vector< SDL_Rect > collisionRects
 

Detailed Description

Represents the tile distrubution for a level.

Todo:
Revise Tile placement implementation.

Constructor & Destructor Documentation

TileMap::TileMap ( const std::string &  mapPath_)

The constructor.

Parameters
mapPath_: Path to the desired Tiled map.

Member Function Documentation

void TileMap::render ( const double  cameraX_,
const double  cameraY_ 
)

Renders the TileMap.

Parameters
cameraX_: The x position of the camera.
cameraY_: The y position of the camera.
void TileMap::renderLayer ( const double  cameraX_,
const double  cameraY_,
const unsigned int  layer_ 
)
private

Renders a certain layer from the TileMap.

Parameters
cameraX_: The x position of the camera.
cameraY_: The y position of the camera.

The documentation for this class was generated from the following files: