Game Engine 2D Platformer
|
TileMap class is used to create and generate a map. More...
#include <TileMap.hpp>
Public Member Functions | |
TileMap (std::string tileSheetFileName, std::string _TileMapPath, int levelWidth, int levelHeight, int _TileSize, SDL_Renderer *ren) | |
Constuctor for a TileMap. Takes in a file path for a tile sheet, file for tile map path, level width, level height, tile size, and a renderer. More... | |
~TileMap () | |
Destructor for a tilemap. More... | |
void | GenerateSimpleMap (std::vector< int > &collectablesAvailable) |
Temporary function for generating a simple map to display some tiles. More... | |
void | PrintMap () |
Function for printing text to console. More... | |
void | SetTile (int x, int y, int type) |
Set the 'type' of tile at an x and y position. More... | |
int | GetTileType (int x, int y) |
Return the tile type at an x and y position. More... | |
void | Render (SDL_Renderer *ren, int x, std::vector< std::shared_ptr< GameEntity >> &obstacles, std::shared_ptr< GameEntity > mainCharacter) |
Draw all of the tiles in the tilemap. More... | |
void | setTileSheetMap (int width, int height) |
Helper function to set the tMap i.e. More... | |
std::vector< int > | getEnemyData () |
TileMap class is used to create and generate a map.
TileMap::TileMap | ( | std::string | tileSheetFileName, |
std::string | _TileMapPath, | ||
int | levelWidth, | ||
int | levelHeight, | ||
int | _TileSize, | ||
SDL_Renderer * | ren | ||
) |
Constuctor for a TileMap. Takes in a file path for a tile sheet, file for tile map path, level width, level height, tile size, and a renderer.
std::string | tileSheetFileName |
std::string | _TileMapPath |
int | levelWidth |
int | levelHeight |
int | _TileSize |
SDL_Renderer | ren |
TileMap::~TileMap | ( | ) |
Destructor for a tilemap.
void TileMap::GenerateSimpleMap | ( | std::vector< int > & | collectablesAvailable | ) |
Temporary function for generating a simple map to display some tiles.
Helper function to generate a simple map and collectables array.
std::vector< int > TileMap::getEnemyData | ( | ) |
int TileMap::GetTileType | ( | int | x, |
int | y | ||
) |
Return the tile type at an x and y position.
Gets tile type.
int | x |
int | y |
void TileMap::PrintMap | ( | ) |
Function for printing text to console.
Helper function to print out the tile map to the console.
void TileMap::Render | ( | SDL_Renderer * | ren, |
int | xPos, | ||
std::vector< std::shared_ptr< GameEntity >> & | obstacles, | ||
std::shared_ptr< GameEntity > | mainCharacter | ||
) |
Draw all of the tiles in the tilemap.
Renders tiles on a screen.
SDL_Renderer | ren |
int | xPos |
std::vector<GameEntity | *> &obstacles |
GameEntity | *mainCharacter |
void TileMap::SetTile | ( | int | x, |
int | y, | ||
int | type | ||
) |
Set the 'type' of tile at an x and y position.
Sets a tile a certain type.
int | x |
int | y |
int | type |
void TileMap::setTileSheetMap | ( | int | width, |
int | height | ||
) |
Helper function to set the tMap i.e.
Sets values of tile sheet into a map.
TileMap for reverse look-up in the Tile Atlas
int | width |
int | height |