Gui

Defold GUI system

Namespace: dmGui
Include: #include <dmsdk/gui/gui.h>
TYPES
HContext A handle to a gui context
HNode A handle to a gui node
HScene A handle to a gui scene
HScript A handle to a gui script
HTextureSource A handle to a texture source, which can be a point...
ENUMS
AdjustMode
AdjustReference
NodeTextureType This enum denotes what kind of texture type the m_...
Playback
Property
Result
Result
FUNCTIONS
void DeleteNode(dmGui::HScene scene, dmGui::HNode node) Defer delete a node
dmGui::HNode GetFirstChildNode(dmGui::HScene scene, dmGui::HNode node) Get first child node
dmGui::HNode GetNextNode(dmGui::HScene scene, dmGui::HNode node) Get next sibling
uint32_t GetNodeCustomData(dmGui::HScene scene, HNode node) get node custom type
void* GetNodeCustomData(dmGui::HScene scene, HNode node) get node custom data
dmhash_t GetNodeId(dmGui::HScene scene, dmGui::HNode node) Get the id of a node.
bool GetNodeIsBone(dmGui::HScene scene, dmGui::HNode node) Query if the node is a bone
dmGui::HNode GetNodeParent(dmGui::HScene scene, dmGui::HNode node) Get the parent of a gui node
dmVMath::Vector4 GetNodeProperty( scene,  node, dmGui::Property property) Get property value
dmhash_t GetNodeTextureId(dmGui::HScene scene, HNode node) get node texture
void* GetResource(dmGui::HScene scene, dmhash_t resource_id, dmhash_t suffix_with_dot) Gets a resource by its resource alias.
void INVALID_HANDLE() Invalid node handle
void LuaPushNode(lua_State* L, dmGui::HScene scene, HNode node) Pushes a dmGui::HNode to the stack
dmGui::HNode NewNode(dmGui::HScene scene, dmVMath::Point3 position, dmVMath::Vector3 size, dmGui::NodeType node_type, uint32_t custom_type)
void SetNodeAdjustMode( scene,  node, AdjustMode adjust_mode) Set adjust mode
void SetNodeId(dmGui::HScene scene, dmGui::HNode node, dmhash_t id) Set the id of a node.
void SetNodeIsBone(dmGui::HScene scene, dmGui::HNode node, bool is_bone) Set the bone state of the node
dmGui::Result SetNodeParent(dmGui::HScene scene, dmGui::HNode node, dmGui::HNode parent, bool keep_scene_transform) Set the parent of a gui node
void SetNodeProperty( scene,  node, dmGui::Property property, dmVMath::Vector4 value) Set property value
void SetNodeTexture(dmGui::HScene scene, HNode node, dmhash_t texture_id) set node texture
void SetNodeTexture(dmGui::HScene scene, HNode node, NodeTextureType type, void* texture) set node texture

Functions

DeleteNode

void DeleteNode(dmGui::HScene scene, dmGui::HNode node)

Defer delete a node

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node the node to delete

GetFirstChildNode

dmGui::HNode GetFirstChildNode(dmGui::HScene scene, dmGui::HNode node)

Get first child node

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node Gets the first child node. If 0, gets the first top level node.

RETURNS

dmGui::HNode The first child node

GetNextNode

dmGui::HNode GetNextNode(dmGui::HScene scene, dmGui::HNode node)

Get next sibling

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node the current sibling

RETURNS

dmGui::HNode the next sibling, or INVALID_HANDLE if no more siblings

GetNodeCustomData

uint32_t GetNodeCustomData(dmGui::HScene scene, HNode node)

get node custom type

PARAMETERS

dmGui::HScene scene the gui scene
HNode node the gui node

RETURNS

uint32_t the custom type. Or 0 if it is no custom type

GetNodeCustomData

void* GetNodeCustomData(dmGui::HScene scene, HNode node)

get node custom data

PARAMETERS

dmGui::HScene scene the gui scene
HNode node the gui node

RETURNS

void* the custom data created per node by the gui node type extension

GetNodeId

dmhash_t GetNodeId(dmGui::HScene scene, dmGui::HNode node)

Get the id of a node.

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node the gui node

RETURNS

dmhash_t the id of the node

GetNodeIsBone

bool GetNodeIsBone(dmGui::HScene scene, dmGui::HNode node)

Query if the node is a bone

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node the gui node

RETURNS

bool true if the node is a bone

GetNodeParent

dmGui::HNode GetNodeParent(dmGui::HScene scene, dmGui::HNode node)

Get the parent of a gui node

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node the gui node

RETURNS

dmGui::HNode the parent, or INVALID_HANDLE is unsuccessful

GetNodeProperty

dmVMath::Vector4 GetNodeProperty( scene,  node, dmGui::Property property)

Get property value

PARAMETERS

scene type: dmGui::HScene] scene
node type: dmGui::HNode] node
dmGui::Property property property enum

RETURNS

dmVMath::Vector4

GetNodeTextureId

dmhash_t GetNodeTextureId(dmGui::HScene scene, HNode node)

get node texture

PARAMETERS

dmGui::HScene scene the gui scene
HNode node the gui node

RETURNS

dmhash_t the currently assigned texture

GetResource

void* GetResource(dmGui::HScene scene, dmhash_t resource_id, dmhash_t suffix_with_dot)

Gets a resource by its resource alias.

PARAMETERS

dmGui::HScene scene the gui scene
dmhash_t resource_id the resource alias
dmhash_t suffix_with_dot the hash of the suffix: hash(".spinescenec")

RETURNS

void* the resource if successful

INVALID_HANDLE

void INVALID_HANDLE()

Invalid node handle

PARAMETERS


LuaPushNode

void LuaPushNode(lua_State* L, dmGui::HScene scene, HNode node)

Pushes a dmGui::HNode to the stack

PARAMETERS

lua_State* L the Lua scene
dmGui::HScene scene the gui scene
HNode node the gui node

NewNode

dmGui::HNode NewNode(dmGui::HScene scene, dmVMath::Point3 position, dmVMath::Vector3 size, dmGui::NodeType node_type, uint32_t custom_type)

PARAMETERS

dmGui::HScene scene the gui scene
dmVMath::Point3 position the position
dmVMath::Vector3 size the size
dmGui::NodeType node_type the node type
uint32_t custom_type If node_type == dmGui::NODE_TYPE_CUSTOM, then this is used to create a custom node data for the registered custom type

RETURNS

dmGui::HNode the created node

SetNodeAdjustMode

void SetNodeAdjustMode( scene,  node, AdjustMode adjust_mode)

Set adjust mode

PARAMETERS

scene type: dmGui::HScene] scene
node type: dmGui::HNode] node
AdjustMode adjust_mode the adjust mode

SetNodeId

void SetNodeId(dmGui::HScene scene, dmGui::HNode node, dmhash_t id)

Set the id of a node.

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node the gui node
dmhash_t id the id

SetNodeIsBone

void SetNodeIsBone(dmGui::HScene scene, dmGui::HNode node, bool is_bone)

Set the bone state of the node

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node the gui node
bool is_bone true if the node is ot be used as a bone

SetNodeParent

dmGui::Result SetNodeParent(dmGui::HScene scene, dmGui::HNode node, dmGui::HNode parent, bool keep_scene_transform)

Set the parent of a gui node

PARAMETERS

dmGui::HScene scene the gui scene
dmGui::HNode node the gui node
dmGui::HNode parent the new parent. May be null
bool keep_scene_transform true to keep the world position

RETURNS

dmGui::Result dmGui::RESULT_OK is successful

SetNodeProperty

void SetNodeProperty( scene,  node, dmGui::Property property, dmVMath::Vector4 value)

Set property value

PARAMETERS

scene type: dmGui::HScene] scene
node type: dmGui::HNode] node
dmGui::Property property property enum
dmVMath::Vector4 value

SetNodeTexture

void SetNodeTexture(dmGui::HScene scene, HNode node, dmhash_t texture_id)

set node texture

PARAMETERS

dmGui::HScene scene the gui scene
HNode node the gui node
dmhash_t texture_id the texture id

SetNodeTexture

void SetNodeTexture(dmGui::HScene scene, HNode node, NodeTextureType type, void* texture)

set node texture

PARAMETERS

dmGui::HScene scene the gui scene
HNode node the gui node
NodeTextureType type the type of texture
void* texture A pointer to a e.g. dmGameSystem::TextureSetResource*

Types

HContext

A handle to a gui context


HNode

A handle to a gui node


HScene

A handle to a gui scene


HScript

A handle to a gui script


HTextureSource

A handle to a texture source, which can be a pointer to a resource, a dmGraphics::HTexture or a dynamic texture created from a gui script.


Enums

AdjustMode

ADJUST_MODE_FIT //!< 0
ADJUST_MODE_ZOOM //!< 1
ADJUST_MODE_STRETCH //!< 2

AdjustReference

ADJUST_REFERENCE_PARENT
ADJUST_REFERENCE_DISABLED

NodeTextureType

This enum denotes what kind of texture type the m_Texture pointer is referencing.

NODE_TEXTURE_TYPE_NONE
NODE_TEXTURE_TYPE_TEXTURE
NODE_TEXTURE_TYPE_TEXTURE_SET

Playback

PLAYBACK_ONCE_FORWARD
PLAYBACK_ONCE_BACKWARD
PLAYBACK_ONCE_PINGPONG
PLAYBACK_LOOP_FORWARD
PLAYBACK_LOOP_BACKWARD
PLAYBACK_LOOP_PINGPONG
PLAYBACK_NONE

Property

PROPERTY_POSITION //!< 0
PROPERTY_ROTATION //!< 1
PROPERTY_SCALE //!< 2
PROPERTY_COLOR //!< 3
PROPERTY_SIZE //!< 4
PROPERTY_OUTLINE //!< 5
PROPERTY_SHADOW //!< 6
PROPERTY_SLICE9 //!< 7
PROPERTY_PIE_PARAMS //!< 8
PROPERTY_TEXT_PARAMS //!< 9
PROPERTY_COUNT //!< 10

Result

NODE_TYPE_BOX //!< 0,
NODE_TYPE_TEXT //!< 1,
NODE_TYPE_PIE //!< 2,
NODE_TYPE_TEMPLATE //!< 3,
NODE_TYPE_PARTICLEFX //!< 5,
NODE_TYPE_CUSTOM //!< 6,
NODE_TYPE_COUNT //!< 7,

Result

RESULT_OK //!< 0
RESULT_SYNTAX_ERROR //!< -1
RESULT_SCRIPT_ERROR //!< -2
RESULT_OUT_OF_RESOURCES //!< -4
RESULT_RESOURCE_NOT_FOUND //!< -5
RESULT_TEXTURE_ALREADY_EXISTS //!< -6
RESULT_INVAL_ERROR //!< -7
RESULT_INF_RECURSION //!< -8
RESULT_DATA_ERROR //!< -9
RESULT_WRONG_TYPE //!< -10