Class Room¶
-
class Room : public ISaveable¶
This class represents a game’s room. It can contain the Player, interactables, collisions and the TileMap
Public Functions
-
Room()¶
Empty constructor
-
Room(const std::string &fileName, int tileSize = 48, bool createPlayer = true)¶
Construct a Room from an .rmap file
-
Room(const RoomBin &bin)¶
Construct a Room by using the RoomBin binary structure
- Parameters:
bin – The binary structure to use
-
virtual json dumpJson()¶
Dump the room’s data into a nlohmann::json object for later use Useful for dumping into a .json file.
- Returns:
The JSON object
-
void unload() const¶
Unload used resources. Typically unloads used Textures by calling raylib’s UnloadTexture
-
void addPlayer(std::unique_ptr<Player> newPlayer)¶
Add the Player into this Room. A unique_ptr is passed whose ownership will be moved into the Room.
- Parameters:
newPlayer – A pointer to the player that will be moved into this Room.
-
TileMap *getTileMap() const¶
Get a pointer to this Room’s TileMap.
- Returns:
A pointer to the room’s TileMap.
-
std::string getMusicSource() const¶
Get filename of the source music.
-
void setMusicSource(const std::string_view &newMusicSource)¶
Set music source.
-
Vector2 getStartTile() const¶
Get the start tile position.
-
void setStartTile(Vector2 newStartTile)¶
Set the start tile position.
-
CollisionsContainer &getCollisions() const¶
Get a reference to the CollisionsContainer of this Room.
-
InteractablesContainer &getInteractables() const¶
Get a reference to the InteractablesContainer of this Room.
-
PropsContainer &getProps() const¶
Get a reference to the PropsContainer of this Room.
-
ActorContainer &getActors()¶
Get a refernece to the collection of Actors.
-
Room()¶