This is code that I've been converting from my 0.5 to 0.6.
When I create a GUI set, I start off with a root IGUITab Control so that I can position the elements. This way, the tab could be moved for where sets of GUI's go and have the offset, which is why all the node are not children of the Root, but children of the IGUITab that is a child of the GUI Environment Root.
The problem is that the children of that IGUITab do not render properly.
This is the bad. If I instead set all the elements as children of the GUI Environment Root, I get the proper look.
Demonstration code can be grabbed here. http://www.saigumi.net/guihandler-bugtrack.zip
GUI Element - Problem with Rendering
GUI Element - Problem with Rendering
Crud, how do I do this again?
Ugh... been trying to track this one down myself.
The closest thing I could find is this in IGUITab control.
But since an empty tab doesn't have a background, it doesn't call that.
Wait a minute, is there some sort of getParentClip() or getParentAbsoluteRect() thing going on? Because a GUITab in nature would have zeroes for all of those and would cause a problem, but I can't quite track down where that would be.
The closest thing I could find is this in IGUITab control.
Code: Select all
if (DrawBackground)
driver->draw2DRectangle(BackColor, AbsoluteRect, &AbsoluteClippingRect);
Wait a minute, is there some sort of getParentClip() or getParentAbsoluteRect() thing going on? Because a GUITab in nature would have zeroes for all of those and would cause a problem, but I can't quite track down where that would be.
Crud, how do I do this again?
Saigumi, are you sure the problem lies in the engine? If I create a IGUITab and add for example two Buttons to it like this (Irrlicht v0.6):
it does exactly what I expect. It places the two buttons relatively to the tab position.
I don't know how you implemented it exactly, I have not taken such a deep look into yor GUIHandler class. But maybe the problem is there somewhere.
Or maybe I got you wrong...
Code: Select all
IGUITab* tab = guienv->addTab(rect<s32>(100, 100, 200, 150));
guienv->addButton(rect<s32>(20, 20, 40, 40), tab, -1, L"1");
guienv->addButton(rect<s32>(60, 20, 80, 40), tab, -1, L"2");
I don't know how you implemented it exactly, I have not taken such a deep look into yor GUIHandler class. But maybe the problem is there somewhere.
Or maybe I got you wrong...
Did you try running the code I provided?
It may be certain GUI elements that cause the problem, which in my GUIHandler uses.
However, in the example provided, the GUIHandler class that I made is not used. I used the GUI Demo straight from Niko and only added a GUITab and set all of the elements to use it as a parent.
It may be certain GUI elements that cause the problem, which in my GUIHandler uses.
However, in the example provided, the GUIHandler class that I made is not used. I used the GUI Demo straight from Niko and only added a GUITab and set all of the elements to use it as a parent.
Crud, how do I do this again?
You mean the demonstration code at http://www.saigumi.net/guihandler-bugtrack.zip? Yes I tried it. And it's rendering is messed up, like in your first screenshot. But it is using your GUIHandler class...
in main():
Further if I take the GUI Demo straight from Niko and add a GUITab and set all of the elements to use it as a parent it works just perfect.
modified 5.UserInterface:
So I still can't reproduce your problem...
in main():
Code: Select all
/*
Initialize GUI Handler
*/
GH = new GUIHandler(device);
/*
Conform Scaling to device screen size
This is un-needed if the GUI XML is set to the size of the device
*/
GH->setScaling(true,irr::core::dimension2d<irr::f32>(512, 384));
/*
Initialize GUI Set
*/
GH->LoadGUI("userinterface.xml", "userinterface");
modified 5.UserInterface:
Code: Select all
IGUITab* tab = env->addTab(rect<s32>(100, 100, 500, 500));
env->addButton(rect<s32>(10,210,100,240), tab, 101, L"Quit");
env->addButton(rect<s32>(10,250,100,290), tab, 102, L"New Window");
env->addButton(rect<s32>(10,300,100,340), tab, 103, L"File Open");
env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true, false, tab);
IGUIScrollBar* scrollbar = env->addScrollBar(true, rect<s32>(150, 45, 350, 60), tab, 104);
scrollbar->setMax(255);
env->addStaticText(L"Logging ListBox:", rect<s32>(50,80,250,100), true, false, tab);
listbox = env->addListBox(rect<s32>(50, 110, 250, 180), tab);