Recommended Posts

Hi
I think I use windows GDI drawing functions wrong way becose I usualy end up flashing graphics. This problem occurs only when I dont want to use wm_paint and I want.. what is it called? loop drawing? any like this:

while(1)
{
GetDC();
//Clear window
// draw to window
ReleaseDC();
}

Sooo is there shometing I can do about it?

0

Share this post

Link to post

Share on other sites

Now ideally you don''t want to do that because Windows is event driven. If you''re writing a game or something, use a timer event to call your routine, don''t just call it ALL the time (for starters the speed difference from one computer to another will be huge).

Most games are keyed to the frame/refresh rate of the monitor so the loop is called only once per-refresh, I use DirectX for this. There might be Windows routines to check the Vertical Blank (maybe). If so use this to call your loop each ''frame''.

Share this post

Link to post

Share on other sites

quote:Original post by Mark Sheeky Now ideally you don''t want to do that because Windows is event driven. If you''re writing a game or something, use a timer event to call your routine, don''t just call it ALL the time (for starters the speed difference from one computer to another will be huge).

Most games are keyed to the frame/refresh rate of the monitor so the loop is called only once per-refresh, I use DirectX for this. There might be Windows routines to check the Vertical Blank (maybe). If so use this to call your loop each ''frame''.