Sign in to follow this  
Kwak

Application-OnIdle gameloop?

Recommended Posts

I implemented my gameloop like this:
__fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner)
{
    Application->OnIdle = IdleLoop;
    _control87(MCW_EM, MCW_EM);     // turn off floating point exceptions
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::IdleLoop(TObject*, bool& done)
{
    drawGame();
    SwapBuffers(hdc);
}


The result was not exactly what i wanted. The screen is only refreshed when the computer is idle, which takes sometimes more than 5 seconds. Impossible to do some animation that way. I did not find any other solution than writing a whole Window-class with its own handleMessages() routine. Any ideas how to solve this in a less drastic way? (I am using the vcl library)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this