Hello all.
Ive googled for the info and yes its talked about, but its a bit vague.
This is what I Have tryed.
I set the windows class cursor to NULL like so
wndclass.hCursor = NULL;, it says to do this to stop windows from changing it back to the default cursor every time the mouse is used.
I then use this bit of code here to load a animated cursor
[source]
HCURSOR MainAppPointer = (HCURSOR)LoadImage(NULL,//HINSTANCE hinst,
cursorname.c_str(),//LPCTSTR lpszName,
IMAGE_CURSOR,//UINT uType,
0,//int cxDesired,
0,//cyDesired,
LR_LOADFROMFILE | LR_DEFAULTSIZE );//UINT fuLoad);
if(MainAppPointer == NULL)
{
MessageBox(Hwnd,"Failed to create cursor", "AppWindow::Create()", MB_OK);
return E_FAIL;
}
[/source]
I then set the cursor with in the winproc callback function, when I recieve the message WM_SETCURSOR
this code here
[source]
LRESULT CALLBACK WProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
//set your window''s class cursor to NULL and then handle the WM_SETCURSOR message like this example:
case WM_SETCURSOR:
{
// only change the cursor when it''s within the client area
if(LOWORD(lParam) == HTCLIENT)
{
//based on some onover event for the mouse EG. over a unit or giving a path
SetCursor(MainAppPointer);
return TRUE;
}
return FALSE;//may be here should I just break at this point
}break;
}
[/source]
doing all this made my elapsed frame time jump from 2ms to 6ms is this normal,
that's 4 ms slower then rendering 11000 pollys with the default cursor on
I then tryed setting the windows class cursor when creating like this
wndclass.hCursor = MainAppPointer; this all works fine but,
it to is 4 ms slower then using just the default cursor.
Is there some thing Im missing, or that sounds about right for a 3 frame 32 X 32 animated cursor.
Im going to try a 16 X 16 cursor I may have the size to big.
the cursor is attached if anyone wants to try it. nope not permitted to up load it sorry.
Whats the correct way to set the mouse cursor in windows.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement