June 26th, 1999
|
#3 |
| I need to register | If you’re interested in creating a window’s program. These functions may help. LoadImage function loads an icon, cursor, or bitmap.
Or LoadCursorFromFile function creates a cursor based on data contained in a file. The file is specified by its name or by a system cursor identifier. The function returns a handle to the newly created cursor. Files containing cursor data may be in either cursor (.CUR) or animated cursor (.ANI) format. SetCursor function establishes the cursor shape (after it has been loaded). ClipCursor function confines the cursor to a rectangular area on the screen (i.e. inside your window or within the screen). ShowCursor function displays or hides the cursor. GetCursorPos function retrieves the cursor’s position, in screen coordinates.
That should enable you to load the cursor, view it and get its location. As for getting mouse clicks; in the WndProc function include the case statements:
case WM_LBUTTONDOWN:
// your code for when the left mouse button was pressed
case WM_RBUTTONDOWN:
// your code for when the right mouse button was pressed
And that should do it. On the other hand, if you’re making a game, I’d recommend using DirectInput (it’s easiest DirectX component to use). I’ve built a <a href=” http://members.home.net/tyler.brandon/tinput.html”>wrapper</a> for DirectInput that makes it even easier to use. The wrapper still needs to be tested, but you’re welcome to give it a try.
You can convert your cursor image to a texture map using Texus (3Dfx’s utility to convert ‘tga’ images to ‘3df’ texture maps). Using the DirectInput wrapper or DirectInput itself to get mouse input, you can then draw your cursor on the screen, like Falcon said, by rendering a texture mapped rectangle.
Hope that helps.
Tanok |
| |
|
| |