Notices

Go Back   FileFront Forums > Main Forums > Tech Discussion

Remember Me?

Tech Discussion
Discuss the latest in Tech, from gaming rigs & graphics cards, to phones & smart watches.
Don't forget Programming 101, and learn to code from our resident experts.

Reply
 
LinkBack Thread Tools Display Modes
Old June 25th, 1999   #1
Mark Carlson
I need to register
 
n/a posts, 0 likes.
Default Mouse Cursor

I'm using Win32, and I have a cursor I want to use in my program. How do I get it so show up so I can see it and capture clicks from it?

Mark
  Reply With Quote
Old June 26th, 1999   #2
I'm too cool to Post
 
Join Date: May 8th, 2000
8 posts, 0 likes.
Rep Power: 0
Falcon[imported] is a n00b
Default

: I'm using Win32, and I have a cursor I want to use in my program. How do I get it so show up so I can see it and capture clicks from it?

: Mark

A cursor is drawn using GDI calls. As the Voodoo 1 and 2 are 3D only, they do not support GDI, so you'll have to draw your own cursor (just use a textured rectangle)
The current position of the mouse can be found by intercepting the WM_MOUSE_MOVE event in the Windows Callback routine (often called WndProc)
The X coordinate is LOWORD(LParam), Y = HIWORD(LParam), where LParam is the last parameter of the callback routine.

The event WM_LBUTTONDOWN and WM_RBUTTONDOWN can be used to intercept clicks.
Falcon[imported] is offline   Reply With Quote
Old June 26th, 1999   #3
Tanok
I need to register
 
n/a posts, 0 likes.
Default

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
  Reply With Quote
Old June 26th, 1999   #4
Mark Carlson
I need to register
 
n/a posts, 0 likes.
Default

Thanks for the input. I spent a lot of today learning DirectInput, so it looks like I will be using it to get the location of the mouse cursor, though I hate to have to actively poll the DirectInputDevice. I may go ahead and use the normal windows messages, since I have that pumping anyway.

Thanks for the input,
Mark

PS tanok-that link to your wrapper does not work. I would like to take a look at it though.
  Reply With Quote
Old June 27th, 1999   #5
Tanok
I need to register
 
n/a posts, 0 likes.
Default


Sorry, about that broken link. Here it is ...

<a href="http://members.home.net/tyler.brandon/tinput.html">wrapper</a>
Or
http://members.home.net/tyler.brandon/tinput.html

Tanok
  Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse Cursor Keeps Disappearing NiRv4n4 Tech Discussion 3 December 5th, 2008 05:49 PM
Mouse Cursor Flicker Rysonue Tech Discussion 1 July 1st, 2008 10:37 AM
Mouse Cursor Won't Go Away Miraz General Gaming 2 March 27th, 2003 01:25 AM
No Mouse Cursor exfileme General Gaming 2 July 25th, 2002 01:15 PM
Scapex: My mouse cursor is dissapearing.... Pumbert General Gaming 4 November 27th, 2000 02:50 PM


All times are GMT -7.







   
 





This site is part of the Defy Media Gaming network

The best serving of video game culture, since 2001. Whether you're looking for news, reviews, walkthroughs, or the biggest collection of PC gaming files on the planet, Game Front has you covered. We also make no illusions about gaming: it's supposed to be fun. Browse gaming galleries, humor lists, and honest, short-form reporting. Game on!

FileFront Forums - Terms of Service - Top
Theme Selection
Copyright © 2002-2016 Game Front. All rights reserved. Powered by vBulletin®
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Forum Theme by Danny King (FileTrekker), Sheepeep & Graeme(rs)
RSS Feed Widget by FeedWind