GuiControls: calling resize() from inside onRender()
by Orion Elenzil · in Torque Game Engine · 12/22/2005 (10:13 am) · 5 replies
How bad is it to call resize() from within a GuiControl's onRender() ?
It seems to work just fine.
- The effects of the resize are delayed by one frame, i believe, but that's fine for me.
If i want to adjust the size/position of a GuiControl every frame,
where would be a better place to do that than onRender ?
tia,
Orion
It seems to work just fine.
- The effects of the resize are delayed by one frame, i believe, but that's fine for me.
If i want to adjust the size/position of a GuiControl every frame,
where would be a better place to do that than onRender ?
tia,
Orion
About the author
#2
thanks.
i'm not adjusting the size every frame, just the position*,
so i think it's actually fairly harmless, but i'll look at throwing it in onPreRender anyhow.
* via my own GuiControl::reposition(), not via resize().
12/22/2005 (12:55 pm)
That's right, onPreRender!thanks.
i'm not adjusting the size every frame, just the position*,
so i think it's actually fairly harmless, but i'll look at throwing it in onPreRender anyhow.
* via my own GuiControl::reposition(), not via resize().
#3
12/22/2005 (4:59 pm)
You want to do it in pre render so that things don't change in the middle of rendering - imagine if you're half way through rendering the some children of a control and then the parent control gets moved!
#4
12/23/2005 (10:05 am)
.. i thought torque was single threaded ?
#5
That's why prerender is there - do all your state changing stuff in there so that you don't get state changed mid-render.
There's lots of ways to break your code without bringing threading into the picture. :)
12/23/2005 (4:06 pm)
Sure, but that doesn't mean there aren't oddly behaved objects like yours that are changing positions in the middle of the render!That's why prerender is there - do all your state changing stuff in there so that you don't get state changed mid-render.
There's lots of ways to break your code without bringing threading into the picture. :)
Associate Kyle Carter