How do I change the mouse cursors like what they do in most strategy games and such?
cursor = cool_cursor()!
To be more exact...
1) hide the regular Windoze cursor:
ShowCursor(false);
2) implement your own cursor, as a sprite. Everytime the mouse moves, update the (x,y) of the cursor. Make sure you bound the mouse to screen size.
3) in strats, when the mouse is over certain stuff the mouse changes, here what I would do is implement a class with a linked list of all the different sprites inside, everytime the mouse moves over the unit, the unit is sent a message (aka called a function) which as an arg is the mouse class, the unit function changes the mouse cursor depending on it''s state and stuff like that.
To be more exact...
1) hide the regular Windoze cursor:
ShowCursor(false);
2) implement your own cursor, as a sprite. Everytime the mouse moves, update the (x,y) of the cursor. Make sure you bound the mouse to screen size.
3) in strats, when the mouse is over certain stuff the mouse changes, here what I would do is implement a class with a linked list of all the different sprites inside, everytime the mouse moves over the unit, the unit is sent a message (aka called a function) which as an arg is the mouse class, the unit function changes the mouse cursor depending on it''s state and stuff like that.
You don''t need to implement a cursor yourself, Windows will do it for you. If your cursor is saved as a bitmap resource, you can use the LoadCursor and SetCursor functions to use it.
Windows cursor handling functions are not adequate for games. That''s why directInput exists, so you''d be much better to do as c++freak just told. That''s not that hard after all.
See ya
See ya
Alphathree: that''s not a very nice thing to say man He was asking a serious question. You should post crap in the GDLounge - not in technical forums !!!
vbisme: are you using Win32 to program your game?
You could ofcourse use DirectX, but Win32 is oke too
To use your own cursor on your window, you have to make a resource cursor, and assign it when you register your window class.
If you want to change cursor at runtime, you must assign a NULL when registering the window class, and catch the WM_SETCURSOR message in your WndProc.
Once you catch it, use the SetCursor() function in combination with LoadCursor() to change it to current cursor you want.
Is this what you''re looking for vbisme?
vbisme: are you using Win32 to program your game?
You could ofcourse use DirectX, but Win32 is oke too
To use your own cursor on your window, you have to make a resource cursor, and assign it when you register your window class.
If you want to change cursor at runtime, you must assign a NULL when registering the window class, and catch the WM_SETCURSOR message in your WndProc.
Once you catch it, use the SetCursor() function in combination with LoadCursor() to change it to current cursor you want.
Is this what you''re looking for vbisme?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement