Force redraw in loop

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
david4482
Posts: 0
Joined: Sun Jul 20, 2008 7:33 pm

Force redraw in loop

Post by david4482 »

In C, not python, how do I force the screen to update (Flush Queue) while in a loop? Do I need to put in a wait so queue is serviced or is there a more direct route?

My loop is more complicated but for example:

Code: Select all

while(1)
{
   allqueue(REDRAWALL, 0);
}

aligorith
Posts: 0
Joined: Sun Dec 05, 2004 3:40 am
Location: Chch, NZ

Post by aligorith »

It really depends on what sort of updates you want to do.

If it's just the current space, you can do

Code: Select all

force_draw(0);

at the end of the code for the loop.

What you're currently trying to do won't help, as the event processing for allqueue doesn't get handled until after the loop has finished, and control is returned back to the main event loop. So, you currently face the risk of an overflowing event-stack.

Also, it's worth noting that when 2.5 work starts picking up again, there will be a new event system that will mean that doing such loops is discouraged.

david4482
Posts: 0
Joined: Sun Jul 20, 2008 7:33 pm

Post by david4482 »

Code: Select all

force_draw(0);

at the end of the code for the loop.
Thanks so much, exactly what I wanted. Re: 2.5, just prototyping something ATM, and will have to rewrite completely if system turns out to be of value. So hope to be looking at how 2.5 works when release build available.

Thanks Again.

Post Reply