-
February 12th, 2010, 06:26 PM
#1
flashy when refresh()
hello guys,
i'm implementing a simple game with c#. question is how to redraw the window form.
my game loop is really simple:
while (!stop)
{
gl.gamelogic();
Refresh();
//Update();
Application.DoEvents();
}
i have tried both refresh and update.
update doesn't really redraw the form immediately unless i resize the form.
refresh redraws the form immediately, but the resulting animation looks really flashy.
how can i get rid of the flashy result? thanks
-
February 12th, 2010, 06:34 PM
#2
Re: flashy when refresh()
You need to double buffer the image that you are drawing. This means that you draw the image in memory and then blt it to the screen very quickly. You can do this very easily in .NET:
Code:
public MyControl( )
{
SetStyle( ControlStyles.UseOptimizedDoubleBuffer, true );
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|