DInput cursor won't display

Started by
6 comments, last by Supernat02 19 years, 8 months ago
Am I doing the following correctly?

D3DXLoadSurfaceFromFileA(cursor, NULL, NULL, "temp\\extract.tmp", NULL, D3DX_FILTER_NONE, D3DCOLOR_XRGB(255, 0, 255), NULL);

MGEgfxref->lpdevice->SetCursorProperties(0,0,cursor);
MGEgfxref->lpdevice->ShowCursor(TRUE);

// And cursor is: LPDIRECT3DSURFACE9	cursor;



// elsewhere
switch( msg )
    {
		case WM_SETCURSOR:
			// Turn off window cursor. 
			SetCursor(NULL);
			return true; // Prevent Windows from setting cursor to window class cursor.
			break;
	}

// elsewhere
MGEgfxref->lpdevice->SetCursorPosition(mousepos.x, mousepos.y, D3DCURSOR_IMMEDIATE_UPDATE);


and I'm frequently getting the mousepos using DInput. Yet for somereason I can't get the custom cursor to show up. (It's a 32x32 .bmp which has been extracted to that "temp\\extract.tmp".) Sorry for kinda double posting but I didn't seem to get a reply by replying to my old post. [Edited by - Tertsi on August 26, 2004 6:40:58 AM]
Advertisement
I've never done a custom cursor but why not just draw your own sprite wherever the mouse is?
In the SDK, the ShowCursor(TRUE) function is between the SetCursor(NULL) and return true calls. Maybe this is picky about that.

Chris
Chris ByersMicrosoft DirectX MVP - 2005
Xegoth I tried that but there are many problems when trying to do it that way and it won't work.. (Unless you consider a flashing screen good.)

Well Supernat the problem is that I can't access the lpdevice anyway in the msg handler function. (Cause you can't change the arguments and the lpdevice is a private class object...)
Quote:Original post by TertsiWell Supernat the problem is that I can't access the lpdevice anyway in the msg handler function. (Cause you can't change the arguments and the lpdevice is a private class object...)

But you CAN access the SetCursor() function in your DI function.
Yes but when the msg handler receives the WM_SETCURSOR msg it will change the damn cursorstate anyway. I tried to put an if statement which would make the msg handler not to get the WM_SETCURSOR msg but can't compare if(msg != WM_SETCURSOR)...

Anybody who has a working custom cursor & Dinput mouse system?
Got this figured out now and my mousesystem is running fine. :)
Just curious, what did you do to fix it? Was it a directory structure problem, a mouse coordinates problem, did you not have the cursor surface created, or something else?

Chris

[Edited by - Supernat02 on August 28, 2004 12:25:54 AM]
Chris ByersMicrosoft DirectX MVP - 2005

This topic is closed to new replies.

Advertisement