Kohi Game Engine
resource_loader Struct Reference

An "interface" for a resource loader. All registered loaders use this. More...

#include <resource_system.h>

Data Fields

u32 id
 The loader identifier. More...
 
resource_type type
 The loader resource type. More...
 
const char * custom_type
 The loader custom type string, if type is set to custom. More...
 
const char * type_path
 A type path which is prepended for the asset type. More...
 
b8(* load )(struct resource_loader *self, const char *name, void *params, resource *out_resource)
 Loads a resource using this loader. More...
 
void(* unload )(struct resource_loader *self, resource *resource)
 Unloads the given resource. Loader is determined by the resource's assigned loader id. More...
 

Detailed Description

An "interface" for a resource loader. All registered loaders use this.

Field Documentation

◆ custom_type

const char* custom_type

The loader custom type string, if type is set to custom.

◆ id

u32 id

The loader identifier.

◆ load

b8(* load) (struct resource_loader *self, const char *name, void *params, resource *out_resource)

Loads a resource using this loader.

Parameters
selfA pointer to the loader itself.
nameThe name of the resource to be loaded.
paramsParameters to be passed to the loader, or 0.
out_resourceA pointer to hold the loaded resource.
Returns
True on success; otherwise false.

◆ type

The loader resource type.

◆ type_path

const char* type_path

A type path which is prepended for the asset type.

◆ unload

void(* unload) (struct resource_loader *self, resource *resource)

Unloads the given resource. Loader is determined by the resource's assigned loader id.

Parameters
selfA pointer to the loader itself.
nameThe name of the resource to be unloaded.

The documentation for this struct was generated from the following file: