This file contains the implementation of the resource system. The resource system is responsible for managing resources and their loaders in the engine.
More...
Go to the source code of this file.
This file contains the implementation of the resource system. The resource system is responsible for managing resources and their loaders in the engine.
- Author
- Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
- Version
- 1.0
- Date
- 2022-01-11
- Copyright
- Kohi Game Engine is Copyright (c) Travis Vroman 2021-2022
◆ resource_loader
An "interface" for a resource loader. All registered loaders use this.
◆ resource_system_config
The configuration for the resource system.
◆ resource_system_base_path()
KAPI const char* resource_system_base_path |
( |
void |
| ) |
|
Returns the base path of the resource system.
◆ resource_system_initialize()
b8 resource_system_initialize |
( |
u64 * |
memory_requirement, |
|
|
void * |
state, |
|
|
void * |
config |
|
) |
| |
Initializes this system. Should be called twice; once to get the memory requirement (passing state=0), and a second time passing an allocated block of memory to actually initialize the system.
- Parameters
-
memory_requirement | A pointer to hold the memory requirement as it is calculated. |
state | A block of memory to hold the state or, if gathering the memory requirement, 0. |
config | The configuration (resource_system_config) for this system. |
- Returns
- True on success; otherwise false.
◆ resource_system_load()
Loads a resource of the given name.
- Parameters
-
name | The name of the resource to load. |
type | The type of resource to load. |
params | Parameters to be passed to the loader, or 0. |
out_resource | A pointer to hold the newly-loaded resource. |
- Returns
- True on success; otherwise false.
◆ resource_system_load_custom()
KAPI b8 resource_system_load_custom |
( |
const char * |
name, |
|
|
const char * |
custom_type, |
|
|
void * |
params, |
|
|
resource * |
out_resource |
|
) |
| |
Loads a resource of the given name and of a custom type.
- Parameters
-
name | The name of the resource to load. |
custom_type | The custom resource type. |
params | Parameters to be passed to the loader, or 0. |
out_resource | A pointer to hold the newly-loaded resource. |
- Returns
- True on success; otherwise false.
◆ resource_system_loader_register()
Registers the given resource loader with the system.
- Parameters
-
loader | The loader to be registered. |
- Returns
- True on success; otherwise false.
◆ resource_system_shutdown()
void resource_system_shutdown |
( |
void * |
state | ) |
|
Shuts down the resource system.
- Parameters
-
state | The state block of memory for this system. |
◆ resource_system_unload()
Unloads the given resource.
- Parameters
-
resource | A pointer to the resource to be unloaded. |