From SIMboxWiki
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);