I'm currently expanding the Irrlicht GUI system in the need of my current project (IRB). I need a "container" window than can contain other GUI's but that we can scroll the content. (Scrolling panels, icon window, etc). My current code is mostly working, but found out that since when we move the scrollers the GUI's are also being moved (and clipped). But there is no reference position/rect to refer to the starting point.
I would propose adding theses methods in IGUIElement.h in the include directory:
A getter:
Code: Select all
IGUIElement::getRerefenceRect()
{
return referenceRect;
}
Code: Select all
IGUIElement::setReferenceRect(rect<s32> rectangle)
{
referenceRect=rectangle;
}
I've not yet implemented this, so if you find a better way of doing this...
In my current GUI, with this I could check all the childrens of the GUI, see if their referenceRect is 0, then put the initial/reference position with the setter.
Then the gui will use the getter to have a reference position when we scroll the window. If you decide to drag or move the item inside the window, you simply update the referenceRect and the GUI will maintain the relative position properly even if the window is being scrolled.
We could use position2D instead, but if the GUI item has changed size, we could also retrieve the information with this referenceRect.
Since it might not be accepted. I will create an array with the rect information directly inside the GUI. This will cause more overhead and might be a slower approach, but will not need patching.
Anyone know if we can clip a GUI from a custom parent clipping rect? I still see stuff not being clipped at the scrollbar. Not a big issue, but could be cleaner if I could clip the children GUI at the scrollbars instead of the frame of the GUI.
As another thing I was thinking of, It would be really interesting to have a template variable that we could set/get in ISceneNode.h to put custom informations (We could create a custom data type with lots of informations and use it there). With this it might be useful a lot for any project to put the "gameobject" or type information inside the node directly.