Archived

This topic is now archived and is closed to further replies.

Nathaniel Hammen

Mouse Input

Recommended Posts

I want to know how to take Input from a mouse. What I need is to know when the left button is down, when the right button is down, when the scroller is being turned, and when the scroller is being pressed in. Edit: I want this to work on Macs as well in the future, so I don't want it to be using Direct Input. [edited by - Nathaniel Hammen on November 15, 2003 1:15:52 AM]

Share this post


Link to post
Share on other sites
Since you requested that it not be platform specific, might I recommend using SDL? SDL provides various input routines (mouse, keyboard, joystick), and is available for a wide variety of platforms--Linux, Windows, Mac, etc...

As far as events for scroll-buttons... this is a different monkey altogether, as differences in widget APIs will bite you in the ass here. Your best bet would be to find a cross-platform widget API to use, which will isolate you from OS-specific widget calls (such as to the Windows API). Perhaps, something like wxWindows.

Anyway, good luck.

Josh
vertexnormal AT linuxmail DOT org


Check out Golem: Lands of Shadow, an isometrically rendered hack-and-slash inspired equally by Nethack and Diablo.

Share this post


Link to post
Share on other sites
if you don''t want to use messages, use

getasynkkeystate

first 3 are buttons on the mouse. could be 5, but I think its 3.


the other one is to check for the current mouse state using the mouse functions for other buttons and the wheel (get its position). The wheels usually increment in either 64 or 128 I think. Forgot. It''s in the docs.


GetAsynkKeyState isextremely fast though, and unlike GetKeyState, it behaves the same under both WinNT kernals and Win9x kernals.

Aslong as under the mac platform you are able to read the current mouse status, you should be fine.
I only ever used clicks on the macos platform though, so I''m not sure what it has.

Share this post


Link to post
Share on other sites