Using a Clipper with the System Cursor
A version of this page is also available for
4/8/2010
DirectDraw applications often need to provide a way for users to navigate using the mouse.
For full-screen exclusive mode applications that use page-flipping, the only option is to implement a mouse cursor manually with a sprite, moving the sprite based on data retrieved from the device or by responding to Windows mouse messages.
However, any application that does not use page-flipping can still use the system's mouse cursor support.
When you use the system mouse cursor, you will sometimes fall victim to graphic artifacts that occur when you blit to parts of the primary surface. These artifacts appear as portions of the mouse cursor seemingly left behind by the system.
A DirectDrawClipper object can prevent these artifacts from appearing by preventing the mouse cursor image from being in the way during a blit operation.
It is a relatively simple matter to implement:
- Create a DirectDrawClipper object by calling the IDirectDraw::CreateClipper method.
- Assign your application's window handle to the clipper with the IDirectDrawClipper::SetHWnd method.
After a clipper is attached, subsequent blits you perform on the primary surface with the IDirectDrawSurface::Blt method will not exhibit the artifact.