#include <Map.h>
Public Member Functions | |
Map (TileSet *tileset, int tilesx, int tilesy) | |
void | setTile (int id, int x, int y, int type) |
void | setTile (Tile *) |
void | drawMap () |
void | loadTileset (char *ptilesetfile, int tilewidth, int tileheight, int tiles) |
void | drawMap (int px, int py) |
Tile * | getTile (int x, int y) |
void | saveMap (const char *file) |
int | loadMap (const char *file) |
void | clearMap () |
Public Attributes | |
int | tilesx |
int | tilesy |
Tile ** | tiles |
TileSet * | tileset |
TTF_Font * | small |
Represents an Map Object for Tile Based Games.
Reserves Memory for the Map
You need to initialize it with an TileSet before using it.
The Number of tiles in Map = tilesy*tilesy
The Map size will be Tilewidth*tilesx and Tileheight*tilesy
Binary Map File Format: \1 int tilesx (4bytes) \2 int tilesy (8bytes) (tilesy*tilesy) id int y int y int type (16 bytes)
void Map::drawMap | ( | ) |
Draws the wohle Map to Screen.
void Map::drawMap | ( | int | px, |
int | py | ||
) |
Draws the wohle Map to Screen at Position x,y.
int Map::loadMap | ( | const char * | file | ) |
Save the current Map as filename.
void Map::loadTileset | ( | char * | ptilesetfile, |
int | tilewidth, | ||
int | tileheight, | ||
int | tiles | ||
) |
void Map::saveMap | ( | const char * | file | ) |
Save the Map as filename.
const | char* filename |
void Map::setTile | ( | int | id, |
int | x, | ||
int | y, | ||
int | type | ||
) |