So I've just run into a problem where it seems that the IGUIEnvironment::drawAll() function must be called to render Gui elements.
I was trying to render them individually myself by calling the draw() function for each element.
The reason I need to do this is because I need to render non-gui stuff in between Gui elements as I have non-gui stuff that must be drawn over some gui elements but under others.
But if you don't call the drawAll() function then CGUIEnvironment::OnPostRender() is never called (and I cannot call it myself as it is not exposed in the interface).
If this doesn't get called then tool tips don't get displayed and scroll bars don't work correctly. There may be other side effects but I haven't noticed them yet.
This dependency on drawAll() seems bad.
I guess the solution would be to expose OnPostRender() assuming that's the only issue with not calling drawAll().
IGUIEnvironment::drawAll() is required?
just do
Code: Select all
gui->getRootGUIElement()->OnPostRender();
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
unfortunately it turns out its way more complex than this:
the drawAll() code also has this resize code (I'm not sure exactly what its for but I assume its needed)
So I had to make and expose a OnPreRender() function that calls this code.
but wait its still not that easy, you have to call the draw() on the tooltip itself but there is no way to access it so i had to add a drawToolTip() function as well.
So I have it working now but its a lot of messing around and the drawAll() functionality should probably be changed so that you have the option of drawing elements yourself without having to add stuff to the engine.
the drawAll() code also has this resize code (I'm not sure exactly what its for but I assume its needed)
Code: Select all
if (Driver)
{
core::dimension2d<s32> dim(Driver->getScreenSize());
if (AbsoluteRect.LowerRightCorner.X != dim.Width ||
AbsoluteRect.LowerRightCorner.Y != dim.Height)
{
// resize gui environment
DesiredRect.LowerRightCorner = dim;
AbsoluteClippingRect = DesiredRect;
AbsoluteRect = DesiredRect;
updateAbsolutePosition();
}
}
but wait its still not that easy, you have to call the draw() on the tooltip itself but there is no way to access it so i had to add a drawToolTip() function as well.
So I have it working now but its a lot of messing around and the drawAll() functionality should probably be changed so that you have the option of drawing elements yourself without having to add stuff to the engine.