Loader
Abstract base class for implementing loaders.
This class provides the foundation for all concrete loaders in the
engine. It handles common loading functionality like path management,
cross-origin settings, and integration with the LoadingManager. All
other loader classes inherit from this class
Methods
Loader()
Default constructor - creates a loader with default settings
Loader(LoaderManager* manager)
Constructor with loading manager
| manager | Loading manager to use for this loader |
binaryData* Loader::load(const string& url, OnLoadCallback onLoad, OnProgressCallback onProgress, OnErrorCallback onError)
Loads assets and returns binary data
| url | Path/URL of the file to be loaded | |
| onLoad | Callback executed when loading completes | nullptr |
| onProgress | Callback executed during loading progress | nullptr |
| onError | Callback executed when errors occur | nullptr |
virtual void* parse(const void* data)
Parses loaded data into engine entities
| data | Raw data to parse |
void setCrossOrigin(const string& crossOrigin)
Sets the cross-origin string for CORS implementation
| crossOrigin | Cross-origin value (e.g., "anonymous") |
void setWithCredentials(bool value)
Sets whether to use credentials in requests
| value | Whether to use credentials |
void setPath(const string& path)
Sets the base path for asset loading
| path | Base path for assets |
void setResourcePath(const string& resourcePath)
Sets the base path for dependent resources
| resourcePath | Base path for resources like textures |
void setRequestHeader(const string& key, const string& value)
Sets a request header for HTTP requests
| key | Header name | |
| value | Header value |
virtual void abort()
Aborts ongoing loading requests
Properties
| crossOrigin | string | Cross-origin string for CORS |
| enabled | bool | Active/inactive |
| id | u32 | Unique identifier |
| isLoader | bool | Read-only tag |
| manager | LoaderManager* | Loading manager instance |
| name | string | Optional display name |
| path | string | Base path for assets |
| requestHeader | map<string, string> | HTTP request headers |
| resourcePath | string | Base path for resources |
| uuid | string | UUID string |
| version | u32 | Bumps on change |
| withCredentials | bool | Whether to use credentials |