Advertisement

mouse flickering:

Started by February 15, 2000 07:38 AM
2 comments, last by DDnewbie 24 years, 7 months ago
Hi, I have encountered an irritating problem when displaying the mouse cursor. I display the usual system cursor in a DirectX-environment (ShowCursor(), I think) but it doesn''t appear at a steady rate, it flickers. The problem is probably due to my rendering of the screen, but how do I get a steady display of the cursor? I''m pretty new to these kind of stuff, but must I use something called ''threading''? Is that hard to implement? Another solution might be to create my own cursor (bitmap-object), is it? Thanks in advance, /DDnewbie Newbie
/Mankind gave birth to God.
The mouse cursor flickers because it doesn''t exist in the backbuffer when flipping. You''re probably better off doing your own cursor and rendering it in the backbuffer.

Anyway, this question has already been asked and answered elsewhere in this forum, so you might want to search for it and check those answers.
Advertisement

You should turn off the system cursor using this Win32 call:

::SetCursor( NULL );

I usually just do this in response to a WM_SETCURSOR
message.

You then need to handle tracking and displaying the mouse
cursor for yourself. The simplest way is to just have a
bitmap that you draw into the appropriate place in back
surface just before you call Flip.


Don''t quote me on this but I think the windows cursor is drawn using GDI and will flciker b\c GDI draws it to the primary buffer at inopportune moments. The problem is easy to fix though. Make your own mouse cursor!

At start of program do:
SetCursor(NULL); //get rid of windows cursor

then use :
POINT point;
GetCursorPos(&point);

Point will then store the mouse position so you can draw a bitmap where the mouse curosr is supposed to be. Do this once per frame for a flicker-free cursor.



Nick V. Caldwell
MIT c\o ''03
nvc@mit.edu
Nick V. CaldwellMIT co ''03nvc@mit.edu

This topic is closed to new replies.

Advertisement