From SIMboxWiki
Revision as of 02:18, 26 February 2013 by Leslie Brown (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You can set the position of an AGI based on the dimensions of its parent element using the getElementSize(...) method. The example code below positions m_hTestAgi in the center of the element.

float fHeight = 0.0f;
float fWidth = 0.0f;

getElementSize(fWidth, fHeight);

Agi::SetXY(m_hTestAgi, 0.5f*fWidth, 0.5f*fHeight);