Archived

This topic is now archived and is closed to further replies.

Flashing windows

This topic is 5377 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

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?

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''.

Mark
Cornutopia Games
http://www.cornutopia.net
Bytten Independent Games Magazine
http://www.bytten.com

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''.

Mark
Cornutopia Games
http://www.cornutopia.net
Bytten Independent Games Magazine
http://www.bytten.com


Thanks but I know that and I usualy use timers. And I also use direct-x but this time I would ''like to'' use GDI.

Share this post


Link to post
Share on other sites