Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Whats the correct way to set the mouse cursor in windows.

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 ankhd   Members   

2301
Like
0Likes
Like

Posted 14 June 2012 - 06:00 AM

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


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;

}



I then set the cursor with in the winproc callback function, when I recieve the message WM_SETCURSOR
this code here



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.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.