Sdk gui component api documentation

Built-in scripting functions.

Namespace: dmGameSystem
Include: #include <dmsdk/gamesys/gui.h>
TYPES
CompGetConstantCallback Used in GetMaterialConstant to resolve a render co...
CompSetConstantCallback Used in SetMaterialConstant to set a render consta...
HComponentRenderConstants Render constants handle
FUNCTIONS
int AreRenderConstantsUpdated(dmGameSystem::HComponentRenderConstants constants) check if the constants have changed
int ClearRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash) Removes a render constant from the container
dmGameSystem::HComponentRenderConstants CreateRenderConstants() Create a new HComponentRenderConstants container
void DestroyRenderConstants(dmGameSystem::HComponentRenderConstants constants) Destroys a render constants container
void DM_DECLARE_COMPGUI_TYPE(C++ symbol name symbol, const char* name, GuiNodeTypeCreateFunction type_create_fn, GuiNodeTypeDestroyFunction type_destroy_fn) Registers a new gui node type to the Gui component
void EnableRenderObjectConstants(dmRender::RenderObject* ro, dmGameSystem::HComponentRenderConstants constants) set the constants of a render object
bool GetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash, dmRender::Constant** out_constant) Destroys a render constants container
dmRender::HConstant GetRenderConstant(dmGameSystem::HComponentRenderConstants constants, uint32_t index) Get a render constant by index
uint32_t GetRenderConstantCount(dmGameSystem::HComponentRenderConstants constants) Get the number of render constants
void GuiNodeTypeDestroyFunction()
void GuiNodeTypeDestroyFunction()
void HashRenderConstants(dmGameSystem::HComponentRenderConstants constants, HashState32* state) Hashes the constants
void SetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmRender::HMaterial material, dmhash_t name_hash, uint32_t value_index, uint32_t* element_index, const dmGameObject::PropertyVar& var) Set a render constant by name. The constant must e...
void SetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash, dmVMath::Vector4* values, uint32_t num_values) Set a render constant by name. The constant must e...

Functions

AreRenderConstantsUpdated

int AreRenderConstantsUpdated(dmGameSystem::HComponentRenderConstants constants)

check if the constants have changed

PARAMETERS

dmGameSystem::HComponentRenderConstants constants the constants

RETURNS

int non zero if the constants were changed

ClearRenderConstant

int ClearRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash)

Removes a render constant from the container

PARAMETERS

dmGameSystem::HComponentRenderConstants constants the constants
dmhash_t name_hash the hashed name of the constant

RETURNS

int non zero if the constant was removed

CreateRenderConstants

dmGameSystem::HComponentRenderConstants CreateRenderConstants()

Create a new HComponentRenderConstants container

PARAMETERS

RETURNS

dmGameSystem::HComponentRenderConstants

DestroyRenderConstants

void DestroyRenderConstants(dmGameSystem::HComponentRenderConstants constants)

Destroys a render constants container

PARAMETERS

dmGameSystem::HComponentRenderConstants constants (must not be 0)

DM_DECLARE_COMPGUI_TYPE

void DM_DECLARE_COMPGUI_TYPE(C++ symbol name symbol, const char* name, GuiNodeTypeCreateFunction type_create_fn, GuiNodeTypeDestroyFunction type_destroy_fn)

Registers a new gui node type to the Gui component

PARAMETERS

C++ symbol name symbol The unique C++ symbol name
const char* name The name of the node type
GuiNodeTypeCreateFunction type_create_fn the create function
GuiNodeTypeDestroyFunction type_destroy_fn the destroy function. May be 0

EnableRenderObjectConstants

void EnableRenderObjectConstants(dmRender::RenderObject* ro, dmGameSystem::HComponentRenderConstants constants)

set the constants of a render object

PARAMETERS

dmRender::RenderObject* ro the render object
dmGameSystem::HComponentRenderConstants constants the constants

GetRenderConstant

bool GetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash, dmRender::Constant** out_constant)

Destroys a render constants container

PARAMETERS

dmGameSystem::HComponentRenderConstants constants the constants
dmhash_t name_hash the hashed name of the property
dmRender::Constant** out_constant the pointer where to store the constant

RETURNS

bool returns true if the constant exists

GetRenderConstant

dmRender::HConstant GetRenderConstant(dmGameSystem::HComponentRenderConstants constants, uint32_t index)

Get a render constant by index

PARAMETERS

dmGameSystem::HComponentRenderConstants constants the constants
uint32_t index the index

RETURNS

dmRender::HConstant the pointer where to store the constant

GetRenderConstantCount

uint32_t GetRenderConstantCount(dmGameSystem::HComponentRenderConstants constants)

Get the number of render constants

PARAMETERS

dmGameSystem::HComponentRenderConstants constants the constants

RETURNS

uint32_t returns the number of set constants

GuiNodeTypeDestroyFunction

void GuiNodeTypeDestroyFunction()

PARAMETERS


GuiNodeTypeDestroyFunction

void GuiNodeTypeDestroyFunction()

PARAMETERS


HashRenderConstants

void HashRenderConstants(dmGameSystem::HComponentRenderConstants constants, HashState32* state)

Hashes the constants

PARAMETERS

dmGameSystem::HComponentRenderConstants constants the constants
HashState32* state the hash state to update

SetRenderConstant

void SetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmRender::HMaterial material, dmhash_t name_hash, uint32_t value_index, uint32_t* element_index, const dmGameObject::PropertyVar& var)

Set a render constant by name. The constant must exist in the material

PARAMETERS

dmGameSystem::HComponentRenderConstants constants the render constants buffer
dmRender::HMaterial material the material to get default values from if constant didn't already exist in the render constants buffer
dmhash_t name_hash the hashed name of the constant
uint32_t value_index index of the constant value to set, if the constant is an array
uint32_t* element_index pointer to the index of the element (in range [0,3]). May be 0
const dmGameObject::PropertyVar& var the constant value

SetRenderConstant

void SetRenderConstant(dmGameSystem::HComponentRenderConstants constants, dmhash_t name_hash, dmVMath::Vector4* values, uint32_t num_values)

Set a render constant by name. The constant must exist in the material

PARAMETERS

dmGameSystem::HComponentRenderConstants constants the constants
dmhash_t name_hash the hashed name of the constant
dmVMath::Vector4* values the values
uint32_t num_values number of values in the array

Types

CompGetConstantCallback

Used in GetMaterialConstant to resolve a render constant's value


CompSetConstantCallback

Used in SetMaterialConstant to set a render constant's value


HComponentRenderConstants

Render constants handle