C++ cursor changes to hour glass using WM_SETCURSOR
OK i have a game when person loses ill set a different cursor. i used the setcursro with loadcusor and WM_SETCURSOR. the problem is that my default cursor which i hae set it where i register my window, it changes to hour glass until the person loses than it changes to the cursor i have set it to. i found that when i use the WM_SETCURS开发者_如何转开发OR it changes the default cusor to hour glass until i set it to a different cursor when person loses. im using win32
any idea?Generally if you're going to change cursors much, you want to do something like:
First we initialize the cursors we'll use:
HCURSOR cursors[3];
cursors[0] = LoadCursor(NULL, IDC_ARROW); // default cursor
cursors[1] = LoadCursor(NULL, IDC_CROSS); // other cursor
cursors[2] = LoadCursor(NULL, IDC_WAIT); // wait cursor
int current_cursor = 0;
When we want to change the cursor we just pick the one we want:
current_cursor = 1;
And our WM_SETCURSOR handler looks something like this:
case WM_SETCURSOR:
SetCursor(cursors[current_cursor]);
return TRUE;
精彩评论