IGUIWindow adding additional element problem

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
ufukbenli
Posts: 1
Joined: Wed Jun 18, 2008 3:08 pm

IGUIWindow adding additional element problem

Post by ufukbenli »

Hi I am new at Irrlicht. I tried to add additional buttons just like the user interface example in the irrlicht source. But I have realized that I can only add elements into small portion of the created window here is my code. the problem is it cannot draw the second button in the window. how can I fix this problem. thanks in advance..

[code]

IGUIWindow* window = env->addWindow(
rect<s32>(100 , 100, 300 , 300),
true, // modal?
L"Test window",env->getRootGUIElement(),100);

env->addButton(rect<s32>(35,35,100,50),
window,
101,
L"Quit",
L"Exits Program");
env->addButton(rect<s32>(35,100,100,50),
window,
102,
L"Restart",
L"Restarts the Program");

[/code]
radubolovan
Posts: 60
Joined: Tue Nov 13, 2007 7:03 pm
Location: Bucharest - Romania
Contact:

Post by radubolovan »

rect<s32> doesn't have x, y, sizeX, sizeY ... it has x1, y1, x2, y2 ... so try:

Code: Select all

env->addButton(rect<s32>(35, 35, 100, 50),...);
env->addButton(rect<s32>(35, 100, 100, 115),...);
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

rect<s32>() has more than one constructor, including one that uses:

core::position2d<s32>()

core::dimensio<s32>()

wich is much more intuitive when creating GUI elements

now.. the prblem here as darbolovan pointed out u have is that u the y2 parameter is lower than the y1 parameter... u might be better of doing something like this

core::rect<s32>(core::position2d<s32>(35, 35), core::dimension2d<s32>(100, 50))

Best regards
Post Reply