Add

From SIMboxWiki
Jump to navigation Jump to search

Description

Use the function Add to add a HAGI to a parent HAGI.

Syntax

AGI_DECL agiRet WINAPI Add(

HAGI hAgi,
HAGI hParent,
bool bShow = true
);

Parameters

HAGI hAgi

[in] The HAGI that should be added.

HAGI hParent

[in] The HAGI parent.

bool bShow = true

[in] Is visible or not.

Return Value

agiOK on success.

Remarks

An AGI object that was added to another AGI object will be affected by its parent transformations (e.g. rotation, movement). See also Hierarchy Concept (Understanding AGI).

It is advisable to build a hierarchial tree (add HAGIs to parents) after all HAGIs were initialized. Be sure the child and the parent HAGIs are valid, to avoid an error message.

Example

// creating HAGIs

_hParent = Agi::createAbstract("Parent");

_hChild = Agi::createRect(10, 10, "Child");


// adding child to parent

int ret = Agi::Add(_hChild, _hParent);

if(ret != agiOK) // checking for success

{

SDK_WARNING("TEST", "one of the AGI handles are not valid");

}