News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Flicker

Started by xroot, August 27, 2008, 04:36:41 PM

Previous topic - Next topic

xroot

Hi,
Can someone help me stop the flicker on xhairs.
I tried to use Chris Hobbs ESF (Eliminating Screen Flicker).
I tried to use the message system with WM_ERASEBKGND and WM_PAINT.
I have tried combinations of the "flags" parm on the RedrawWindow api.
There is a simple solution but can't find it.
Thanks for any help.

[attachment deleted by admin]

hutch--

xroot,

Without having looked at your example, flicker is generally the interaction of two or more screen refreshes on the same area of the screen, generally the client area of a window. Thre are a couple of approaches as long as you undersand what is happening. If the main window is covered by another window, an edit control for example, set the main window background brush to NULL or HOLOW_BRUSH and you reduce one source of flickering as you remove one repaint for the windows client area.

If your window does not need it, do not set the CS_VREDRAW ans CS_HREDRAW style to the WNDCLASSEX and this reduces the repaint count by a lot.

If you are drawing text on the client area and getting flicker from some interaction, create a back buffer, do all of the messy flickery stuff there and BitBlt the result to the screen's client area.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

xroot

Hutch,
I draw direct to the desktop no window. I did try a back buffer, and it did not help, I might not of set it up right.
Please look @ my code to see what's wrong.
Thanks

MichaelW

The flicker is a result of redrawing the desktop window ever time the mouse is moved. The attachment contains a modification of your code that uses the simplest method of eliminating the flicker that occurred to me. Basically, it saves the background behind the lines before they are drawn, erases the old lines by restoring the background before drawing the new lines, and never redraws the desktop window.

[attachment deleted by admin]
eschew obfuscation