Defold Learn logo


Contextregistry

A named registry for engine-owned context pointers.

Include: #include <dmsdk/dlib/context_registry.h>
TYPES
HContextRegistry Context registry handle.
FUNCTIONS
void* ContextRegistryGet (HContextRegistry registry, const char* name) Gets a context from the context registry using a s...
void* ContextRegistryGetByHash (HContextRegistry registry, dmhash_t name_hash) Gets a context from the context registry using a s...
int ContextRegistrySet (HContextRegistry registry, const char* name, void* context) Sets a context in the context registry using a spe...
int ContextRegistrySetByHash (HContextRegistry registry, dmhash_t name_hash, void* context) Sets a context in the context registry using a spe...

Functions

ContextRegistryGet

void* ContextRegistryGet(HContextRegistry registry, const char* name)

Gets a context from the context registry using a specified name.

PARAMETERS

HContextRegistry registry the context registry
const char* name the context name

RETURNS

void* The context, if it exists

ContextRegistryGetByHash

void* ContextRegistryGetByHash(HContextRegistry registry, dmhash_t name_hash)

Gets a context from the context registry using a specified name hash.

PARAMETERS

HContextRegistry registry the context registry
dmhash_t name_hash the context name hash

RETURNS

void* The context, if it exists

ContextRegistrySet

int ContextRegistrySet(HContextRegistry registry, const char* name, void* context)

Sets a context in the context registry using a specified name.

PARAMETERS

HContextRegistry registry the context registry
const char* name the context name
void* context the context, or 0 to remove the context

RETURNS

int 0 if successful

ContextRegistrySetByHash

int ContextRegistrySetByHash(HContextRegistry registry, dmhash_t name_hash, void* context)

Sets a context in the context registry using a specified name hash.

PARAMETERS

HContextRegistry registry the context registry
dmhash_t name_hash the context name hash
void* context the context, or 0 to remove the context

RETURNS

int 0 if successful

Types

HContextRegistry

void HContextRegistry()

Context registry handle.

PARAMETERS