GUI Element Children not rendering

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
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

GUI Element Children not rendering

Post by saigumi »

I tried to create a menu by creating a blank image and smacking the text on it as children, but when I do this, the children do not render.

I had assumed that the children would function the same as the way that 3D sceneNodes function, but I might be wrong.

Anyone see an error?

Code: Select all

	Menu.Holder = device->getGUIEnvironment()->addImage(irr::core::rect<irr::s32>(size.Width-200,size.Height-300, size.Width-10, size.Height-10));
	Menu.Options[0] = device->getGUIEnvironment()->addStaticText(L"Move", false, irr::core::rect<irr::s32>(5,5,80,20),Menu.Holder,-1);
Crud, how do I do this again?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

No, you found a bug. Seems that nobody tried to use an image as parent before. The line
IGUIElement::draw();
is missing in the end of the method CGUIImage::draw(). Sorry.
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

*updated code at 5:16pm*

Alright. I have already "worked around" it, even though the work around is a way better way of performing the same functionality.

I'm using a gui element ListBox instead and switched my control scheme to allow keyboard input to handle listbox controls. This control is external to the list elements control scheme. That way, users can either use the mouse, keyboard, or controller.

My code

Code: Select all

/*----------------------------------------------------------------------------------------------
Process Menu KeyPresses
----------------------------------------------------------------------------------------------*/
void BlockWar::ActionListCommand(irr::u32 KeyInput) {
	switch (KeyInput) {
		case irr::KEY_ESCAPE:
			State = STATE_NORMAL;
			ActionList->setVisible(false);
			break;
		case irr::KEY_KEY_W:
			if (ActionList->getSelected() > 0)
				ActionList->setSelected(ActionList->getSelected() - 1);
			break;
		case irr::KEY_KEY_S:
			if (ActionList->getSelected() < ActionList->getItemCount())
				ActionList->setSelected(ActionList->getSelected() + 1);
			break;
		case irr::KEY_RETURN:
			//!Generate ButtonPress Event
			const wchar_t* temp = ActionList->getListItem(ActionList->getSelected());
			//!Do stuff here
			break;
	}
}
This is called from OnEvent:

Code: Select all

ActionListCommand(event.KeyInput.Key);
Crud, how do I do this again?
Post Reply