Page 1 of 1

IGUIWindow adding additional element problem

Posted: Wed Jun 18, 2008 3:15 pm
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]

Posted: Wed Jun 18, 2008 3:32 pm
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),...);

Posted: Wed Jun 18, 2008 6:05 pm
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