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_SETCURSOR it changes the default cusor to hour glass until i set it to a different cursor when person loses. im using win32
any idea?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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;