IGUIEnvironment::drawAll() is required?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Mloren
Posts: 114
Joined: Mon Aug 07, 2006 2:30 am
Location: Australia
Contact:

IGUIEnvironment::drawAll() is required?

Post by Mloren »

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().
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

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.
Mloren
Posts: 114
Joined: Mon Aug 07, 2006 2:30 am
Location: Australia
Contact:

Post by Mloren »

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)

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();
	}
}
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.
Post Reply