-
Notifications
You must be signed in to change notification settings - Fork 28
Project
A Project represents the whole LDtk project file and can contain one or multiple worlds.
ldtk::Project::Project()Default constructor.
loadFromFileloadFromMemorygetFilePathgetDefaultPivotgetDefaultCellSizegetBgColorallTilesetsgetTilesetallWorldsgetWorldgetEnumgetLayerDefgetEntityDefallTocEntitiesgetTocEntitiesByName
ldtk::Project::LoadFromFile(const std::string& filepath)Load a LDtk project from a given file path.
After this method is executed, everything will be loaded in the Project object.
Throws an exception in case of failure.
ldtk::Project::loadFromFile(const std::string& filepath, const FileLoader& file_loader)This overload allows loading a LDtk project using a custom stream.
This allows for example, to load a file from a virtual filesystem.
See FileLoader.
ldtk::Project::loadFromMemory(const std::vector<std::uint8_t>& bytes)ldtk::Project::loadFromMemory(const unsigned char* data, size_t size)Load a LDtk project from a string in memory.
ldtk::Project::getFilePath() const -> const ldtk::FilePath&Returns the path of the file from which the Project was loaded.
ldtk::Project::getDefaultPivot() const -> const ldtk::FloatPoint&Returns the default pivot, a point from (0.f, 0.f) to (1.f, 1.f).
ldtk::Project::getDefaultCellSize() const -> intReturns the default size of a cell in the Project's world grid.
Cell dimension is (size, size).
ldtk::Project::getBgColor() const -> const ldtk::Color&Returns the default background color of the Project.
ldtk::Project::allTilesets() const -> const std::vector<ldtk::Tileset>&Returns a vector containing all the Tilesets of the Project.
ldtk::Project::getTileset(int id) const -> const ldtk::Tileset&ldtk::Project::getTileset(const std::string& name) const -> const ldtk::Tileset&Returns the Tileset matching the given id or name.
If no Tileset is found, an invalid_argument exception is thrown.
ldtk::Project::allWorlds() const -> const std::vector<ldtk::Project>&Returns a vector containing all the Worlds of the Project.
ldtk::Project::getWorld() const -> const ldtk::Project&For Projects with only one world, returns the World.
If the project has multiple worlds, an invalid_argument exception is thrown.
ldtk::Project::getWorld(const std::string& name) const -> const ldtk::Project&For projects with multi-worlds enabled, returns the World matching the given name.
If no World is found, an invalid_argument exception is thrown.
ldtk::Project::getEnum(int id) const -> const ldtk::Enum&ldtk::Project::getEnum(const std::string& name) const -> const ldtk::Enum&Returns the Enum matching the given id or name.
If no Enum is found, an invalid_argument exception is thrown.
ldtk::Project::getLayerDef(int id) const -> const ldtk::LayerDef&ldtk::Project::getLayerDef(const std::string& name) const -> const ldtk::LayerDef&Returns the LayerDef matching the given id or name.
If no LayerDef is found, an invalid_argument exception is thrown.
ldtk::Project::getEntityDef(int id) const -> const ldtk::EntityDef&ldtk::Project::getEntityDef(const std::string& name) const -> const ldtk::EntityDef&Returns the EntityDef matching the given id or name.
If no EntityDef is found, an invalid_argument exception is thrown.
ldtk::Project::allTocEntities() const -> const std::vector<EntityRef>&Returns a vector containing the EntityRefs that are located in the ToC.
ldtk::Project::getTocEntitiesByName(const std::string& name) const -> const std::vector<EntityRef>&Returns a vector containing the EntityRefs with the given name, that are located in the ToC.