File tileset.hpp¶
Typedefs
-
using json = nlohmann::json
-
class TileSet : public ISaveable
- #include <tileset.hpp>
The TileSet class represents a collection of tiles that can be used for a TileMap or another object
See also
TileMap
Public Functions
-
TileSet()
Empty constructor.
-
TileSet(const std::string &fileName)
Constructor that takes the path to the .rtiles file
-
TileSet(const std::string &textureSource, Vector2 tileSize)
Constructor that takes the path of the texture (image file) and a Vector2 that represents the tile size
-
TileSet(const std::string &textureSource, int tileSizeInt)
Like TileSet(std::string textureSource, Vector2 tileSize), but takes an int for tile size with identical width and height (square tiles)
-
TileSet(const Texture &texture, Vector2 tileSize)¶
-
TileSet(TileSetBin bin)
Constructor that takes the TileSetBin binary structure
-
~TileSet()¶
-
void unload() const
Unload routine
-
Vector2 getTileSize() const
Get the size of a tile. Since a tile may have different width and height, it returns a Vector2
-
void setTileSize(int size)
Set the tile size to an integer value. Both width and height will be this value.
-
void setTileSizeVector(Vector2 vec)
Set the tile size to a Vector2 value. The x component is taken for width; the y component is taken for height.
-
int getTileHeight()
Get the height of a tile unit in this TileSet.
-
int getTileWidth()
Get the width of a tile unit in this TileSet.
-
void setTileHeight(int value)
Set a tile unit height.
-
void setTileWidth(int value)
Set a tile unit width.
-
Texture getTexture() const
Get the texture of this TileSet.
- Returns:
A raylib Texture.
-
std::string getTextureSource()
Get the path to the texture image file.
-
void setTextureSource(const std::string &source)
Set the TileSet’s texture source image.
-
std::string getSource()
Get the path to the file that represents this TileSet.
-
bool areAtlasCoordsValid(Vector2 atlasCoords) const
Check whether the given coordinates are valid
-
TileSet()