gui elements

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
dreamport
Posts: 188
Joined: Sun Jul 26, 2009 9:02 am
Location: philippines

gui elements

Post by dreamport »

is there a way to get the number of gui elememnts existing on my screen,

and their x and y coordinates?

thnx
opensource = freedom
<br>
how can you face the problem if the problem is your face?
CuteAlien
Admin
Posts: 9933
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

IGUIEnvironment::getRootGUIElement () returns the top gui-element. From there on you can recursively check getChildren () to access all elements.

For an example of such a recursive function check getElementFromPoint in IGUIElement.h
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
dreamport
Posts: 188
Joined: Sun Jul 26, 2009 9:02 am
Location: philippines

Post by dreamport »

Code: Select all

irr::gui::IGUIElement *elem;
				elem = dev->getGUIEnvironment()->getRootGUIElement();
				irr::gui::SGUIElementList list;
				list = elem->getChildren();
				printf("\n\nnumber: %d \n\n", list.size);
it always returns 4 for all my game page...

so how can i get the number of elements on my current page?
opensource = freedom
<br>
how can you face the problem if the problem is your face?
CuteAlien
Admin
Posts: 9933
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Do check the getElementFromPoint function... it does a IsVisible check as well as calling itself recursive (you have to check the children of the children and the children of those... etc).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
dreamport
Posts: 188
Joined: Sun Jul 26, 2009 9:02 am
Location: philippines

Post by dreamport »

ok, i'll try that one out... thnx for the help!!!
opensource = freedom
<br>
how can you face the problem if the problem is your face?
Post Reply