Advertisement

Setting windows mouse cursor in dx full screen mode

Started by February 07, 2000 01:34 PM
0 comments, last by executor 24 years, 10 months ago
I''m trying to set a custom mouse cursor in DX full screen mode. It''s a 256 color mouse cursor. It works on some video cards (or systems, I don''t know if the video card is the problem), but on others the mouse cursor is flipping badly. If the cursor is monochrome, it works OK. If it''s a colored cursor, it doesn''t. I tryed creating the main window with that cursor, setting the system mouse after the window was created (SetSystemCursor) or handling the WM_SETCURSOR message. Nothing works OK on all systems. Blitting a sprite for the cursor is two slow if the frame rate goes down too much (the cursor moves too slow). Maybe dirty rectangle for the mouse cursor would work. Or another thread that blits the mouse cursor on the primary surface (with dirty rectangle). I didn''t try these last methods yet but maybe some of you did. If anyone can help me... Thanks.
The problem you''re experiencing is caused because
Windows only draws it''s mouse cursor to the GDI
surface. In most cases, this is the primary surface
when you first initialize DDraw. So it only draws
the mouse cursor to the displayed surface on every
other flip.

You need to draw the mouse cursor yourself in order
to make it appear correctly. This means you have to
draw it to your back surface right before each flip.
I''ve found the best way to get around a sluggish cursor
when the frame rate drops is to have a separate thread
to update the mouse to the primarty surface when the
mouse moves. If you''re using DirectInput for your
mouse, you can create an event that will be signalled
whenever there is mouse input. Your thread can wait
for this event and then update the mouse cursor if
necessary. For a complete implementation of this method,
see Stan Trujillo''s book, High Performance Windows
Graphics Programming.

This topic is closed to new replies.

Advertisement