Receiving mouse clicks from different buttons - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Receiving mouse clicks from different buttons (/thread-7756.html)
Receiving mouse clicks from different buttons - Tobi - May 18, 2002 01:55 AM
I'm using the Classic/Carbon function Button() to get the state of the mouse button. However, this function returns true if any of the two buttons is down. And I want to support at least a two-button mouse in my game. On Macs a click with the right button is like a mouse click with the control key down. This way I can check whether the right or left mouse button is down. But if I click both the right and the left button, the left mouse button is ignored of course. Also if I click with the left button and hold the control-key down the game will think that the right button is clicked. Is there a way to get the state of the mouse buttons seperately?
I want to put the jump on the right mouse button and the gun shot on the left button, but with the current method the player would not be able to shoot when jumping.
Thanks in advance,
Receiving mouse clicks from different buttons - codemattic - May 18, 2002 10:15 AM
If you are willing to restrict your game to carbon, you should use carbon events. They will let you know which button is clicked, or even if the mouse wheel is moved (so you can zoom in your sniper scope for ex. - or maybe to change weapons!)
http://developer.apple.com/techpubs/macosx/Carbon/CarbonPortingTools/carbon_porting_guide/cpg_newtechstruct/An_Example__s_to_Sample.html and http://developer.apple.com/techpubs/macosx/Carbon/oss/CarbonEventManager/carboneventmanager.html
If you also want to support classic - maybe you could see if Input Sprockets supports multi-button mice.
Receiving mouse clicks from different buttons - Deland - May 18, 2002 05:29 PM
Quote:Originally posted by codemattic
Is there anything on Cocoa? Just wondering...
Receiving mouse clicks from different buttons - OneSadCookie - May 18, 2002 06:06 PM
Cocoa has documented support for three mouse buttons, and (I think as yet) undocumented support for up to 32. If you're interested, see the Omni Group's GDC sample code.
Receiving mouse clicks from different buttons - Deland - May 18, 2002 06:43 PM
Quote:Originally posted by OneSadCookie
hmmm... Can't wait for that 32 Buttons USB Mouse to come out on Mac!
Receiving mouse clicks from different buttons - Josh - May 18, 2002 07:55 PM
I can see it now... "Grr... I can never remember if button 27 updates my website or if that is button 14..."
Receiving mouse clicks from different buttons - Tobi - May 20, 2002 12:22 AM
OK, thanks your help. My prog has now support for 3 buttons on OS X now using the Carbon Event Manager. For some reason Apple also put special functions just for Wacom Tablets inside their Framework, just because the Tablet Mouse does not consider itself a multi-button mouse. It submits 1 as the button code regardless of what button you click. The following method should work with nearly every multi-button mouse, but not with the tablet:
Why can Apple not include a function like GetAsyncKeyState() on Windoze?
This is a cool combination of the Mac GetKeys() and Button() function which works perfectly with all keyboards and mice.