Sign in to follow this  

Untitled

This topic is 3860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

SDL uses a slightly different approach. In general you would re-draw the screen every frame. Most fast paced games pretty much require this anyway.

So in your main loop ( as SDL lets you handle the loop, rather than delegating it):


void draw() { /* stuff */ }

int main( int, char ** ) {

// init code

while(running) {
// handle input events
draw();
SDL_GL_SwapBuffers();
}
}



However, if your program is more input or event oriented you may not wish to redraw the screen more often than required, say only when the player moves. You still want to redraw when your application becomes obscured by something and needs refreshing. Handling the SDL_VIDEOEXPOSE event should help in such a program.

Share this post


Link to post
Share on other sites

This topic is 3860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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