Click to See Complete Forum and Search --> : How to use emulated cursor when window


itree
March 12th, 2005, 02:37 PM
i use IDirect3DDevice9::SetCursor method to draw cursor.
it work well under fullscreen mode.
but when windowed, it change to GDI cursor, and make it flickering.
how can i use an emulated cursor when windowed?

Elementer
March 12th, 2005, 03:52 PM
Hello,
what do you mean ? For GDI cursor you mean a resource cursor that you load and show it with ShowCursor(TRUE/FALSE) ? Are you mixing this function with D3D one ?
Better way to use cursor in a graphics application like D3D, is use a image that you move on the screen with mouse movements, and forget .cur files. Anyway, explain more detail about your problem, we can't undestand why you get error.

Bye

itree
March 12th, 2005, 11:09 PM
The code as followed:
//create cursor surface
CreateOffscreenPlainSurface( Width, Height, D3DFMT_A8R8G8B8,
D3DPOOL_SCRATCH, &m_pCursorSurface, NULL );
D3DXLoadSurfaceFromFile(m_pCursorSurface,NULL,NULL,"cursor.png",
D3DX_FILTER_NONE,0,NULL);

m_pd3dDevice->SetCursorProperties( 0, 0, m_pCursorSurface);
m_pd3dDevice->ShowCursor( TRUE );

...
// in WinProc Function
case WM_SETCURSOR:
// Turn off window cursor
SetCursor( NULL );
m_pd3dDevice->ShowCursor( TRUE );
return TRUE;

when windowed, the cursor flickering.
when full-screen, the cursor works well, but i must trap WM_MOUSEMOVE events and call DXSetCursorPosition.
so i think that the application use GDI cursor when windowed, rather than software emulation.

Have any simple way to use cursor in windowed mode, instead of drawing it manually?

Elementer
March 13th, 2005, 06:56 AM
Hi,
I'm not able to figure it out sorry, I don't use D3D...

Cheers