File tilemap.hpp¶
Defines
-
_RPGPP_TILESIZE¶
Typedefs
-
using json = nlohmann::json
-
class TileMap
- #include <tilemap.hpp>
A TileMap represents a map of the placed tiles in a Room.
Public Functions
-
TileMap(const std::string &fileName)
Construct from a file name/path
-
TileMap(const std::string &tileSetSource, int width, int height, int atlasTileSize, int worldTileSize)
Construct using a TileSet path, width, height
-
TileMap(const TileSet &tileSet, int width, int height, int atlasTileSize, int worldTileSize)
Constructor using a TileSet object
-
TileMap(std::unique_ptr<TileSet> tileSetPtr, int width, int height, int atlasTileSize, int worldTileSize)
Constructor using a unique_ptr of a TileSet
-
void unload() const
Unload routine. Typically calls raylib’s UnloadTexture.
-
void update() const
Update routine.
-
void draw() const
Draw routine.
-
std::string getTileSetSource() const
Get the path of the TileSet resource
-
void setTileSet(const std::string &tileSetSource)
Set a new TileSet for this TileMap using a path for the new TileSet
-
int getAtlasTileSize() const¶
-
int getWorldTileSize() const¶
-
bool atlasPosIsValid(Vector2 atlasPos) const¶
-
bool worldPosIsValid(Vector2 atlasPos) const¶
-
void setTile(Vector2 worldPos, Vector2 atlasPos)
Set the tile at the specified world position to be a tile at the specified atlas position from the TileSet.
-
void setEmptyTile(Vector2 worldPos)
Set the tile at the specified world position to be empty (not drawn).
-
void drawTile(int x, int y) const
Draw the tile at the specified world x and y coordinates.
-
void drawTile(Vector2 worldPos, Vector2 atlasPos) const¶
-
Vector2 getMaxAtlasSize() const¶
-
Vector2 getMaxWorldSize() const
Get the size of this TileMap
- Returns:
the size in a Vector2. The x component is the width; the y component is the height.
-
void setWorldSize(Vector2 size)
Set the size of this TileSet using the provided Vector2 argument. The x ocmponent will be the new width; the y component will be the new height.
-
TileMap(const std::string &fileName)