![]() |
Shkyera Engine
Easy to use, game engine for Python
|
Classes | |
| class | CubeMapLoader |
| class | FactoryAssetLoader |
| class | MaterialLoader |
| class | PathAssetLoader |
| class | ShaderLoader |
| HandleAndAsset< AssetType > shkyera::utils::assets::add | ( | Registry * | registry, |
| std::filesystem::path && | path | ||
| ) |
Adds a new asset to the ECS registry, reads it, and returns a shared pointer to the asset. This is a combination of adding the asset and reading it from the AssetComponent in one step.
| AssetType | The type of the asset to add and read |
| Args | The argument types required for constructing the asset |
| registry | Pointer to the ECS registry |
| args | Arguments to be forwarded to the constructor of AssetComponent |
| HandleAndAsset< AssetType > shkyera::utils::assets::add | ( | Registry * | registry, |
| std::unique_ptr< AssetLoader< AssetType > > | loader | ||
| ) |
Adds a new asset of the specified type to the registry and returns the asset handle along with a reference to the associated AssetComponent.
| AssetType | The type of the asset to add |
| Args | The argument types required for constructing the asset |
| registry | Pointer to the ECS registry |
| args | Arguments to be forwarded to the constructor of AssetComponent |
| HandleAndAsset< AssetType > shkyera::utils::assets::add | ( | Registry * | registry, |
| typename AssetType::Factory::Type | type | ||
| ) |
At first call, construct an Asset using the provided factory method. At later calls, return the oprevously constructed Asset.
| registry | Pointer to the ECS registry |
| std::vector< AssetHandle > shkyera::utils::assets::getSubdirectories | ( | AssetHandle | directory, |
| Registry const * | registry | ||
| ) |
Retrieves all subdirectories from the specified directory asset.
| directory | Handle to the directory asset whose subdirectories are to be retrieved |
| registry | Pointer to the ECS registry to access entity components |
| AssetRef< AssetType > shkyera::utils::assets::read | ( | AssetComponent< AssetType > & | assetComponent | ) |
Reads the asset from the provided AssetComponent by either retrieving the cached asset or constructing a new asset and storing it in the component.
| AssetType | The type of the asset to read |
| assetComponent | Reference to the AssetComponent holding the asset data |
| AssetRef< AssetType > shkyera::utils::assets::read | ( | const std::filesystem::path & | path, |
| Args &&... | args | ||
| ) |
Constructs an asset of the specified type from a specified path with given constructor arguments.
| AssetType | The type of the asset to read |
| Args | Constructor argument pack |
| assetComponent | Reference to the AssetComponent holding the asset data |
| args | Constructor parameters |
| AssetRef< AssetType > shkyera::utils::assets::read | ( | Registry * | registry, |
| HandleAndAsset< AssetType > & | handleAndAsset | ||
| ) |
| AssetRef< AssetType > shkyera::utils::assets::readPermanent | ( | const std::filesystem::path & | path, |
| Args &&... | args | ||
| ) |
At first call, adds a new asset to the ECS registry, reads it and returns a shared pointer to the asset. At later calls, it returns an already loaded asset. This function GUARANTEES that a once loaded asset will never be unloaded. It should not be used for loading large assets. The permanent assets DO NOT have a handle and DO NOT exist in any registry;
| AssetType | PathConstructible AssetType defining the type of the asset to add and read |
| Args | The argument types required for constructing the asset |
| path | Path to the asset |
| args | Arguments to be forwarded to the constructor of AssetComponent |
| AssetRef< AssetType > shkyera::utils::assets::readPermanent | ( | typename AssetType::Factory::Type | type | ) |
| std::optional< AssetHandle > shkyera::utils::assets::registerAll | ( | std::filesystem::path | path, |
| Registry * | registry | ||
| ) |
If path points to a directory, it recursively traverses the root directory and registers all assets, including both files and directories. If path poitns to a file, it registers a single file.
| root | Path to the initial asset |
| registry | Non-owning pointer to the ECS registry |
| std::optional< AssetHandle > shkyera::utils::assets::registerSingle | ( | std::filesystem::path | path, |
| Registry * | registry | ||
| ) |
Registers the asset at the specified path in the registry. Asset type will be deduced. It can be either a file or a directory. This function does NOT traverse the filesystem if the asset is a directory.
| root | Path to the asset (directory or file) to register |
| registry | Non-owning pointer to the ECS registry |