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

## 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 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 on other sites
If you aren''t already, double buffering probably would be a good thing to use.

Qui fut tout, et qui ne fut rien

##### 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 on other sites
quote:
If you aren''t already, double buffering probably would be a good thing to use.

Qui fut tout, et qui ne fut rien

Nope I wasn''t, thanks for the link!

• ### Forum Statistics

• Total Topics
628686
• Total Posts
2984232

• 14
• 13
• 13
• 10
• 10