Getting mouse location
How do I get the mouse location? I don't really want to use the mouseMoved events, as I have one place in which I need to know where the mouse is at that instant, and thus it seems to be a place for query-driven mousing instead of event-driven. And, there's no NSMouse object
([NSMouse whereAmI] hehe)
([NSMouse whereAmI] hehe)
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
I don't know about Cocoa, but there's always Carbon's GetMouse() function.
Thanks.
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Is there a similar thing for keys? NSEvent doesn't seem to have any more. Key repeat delays are screwing with my game...
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Just keep an array of which keys are pressed, set the appropriate element to true when a key goes down and to false when the key comes back up again.
How do I get key up events, then?
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
If you're using the standard NSResponder stuff, override -keyUp:
Ok, I don't understand something here. When I looked for the documentation on keyUp, I saw that there was a corresponding keyDown method. I was previously using performKeyEquivalent. Why does keyDown not work? It just beeps at me...
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Have you set the receiving view as first responder?
You need to become the first responder.
check to make sure that your view is the first responder.
Heh, nice timing... Thanks. That did it. I'll try the array idea now...
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Is there a better method than BOOL keyArray[65536]? Do I have to cover every unichar?
Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
If you use keyCodes, there are only 128... but really you only need remember the state of keys you care about. I generally do it as an array of "game inputs" rather than as an array of keys.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| ending location from angle and speed | Kazooless | 5 | 3,917 |
Apr 3, 2009 02:40 PM Last Post: Gillissie |
|
| polling mouse location? | alloca | 1 | 2,211 |
Jan 22, 2009 04:14 PM Last Post: ThemsAllTook |
|
| Cocoa: Mouse location while dragging window | Fenris | 4 | 4,484 |
Jul 14, 2005 04:46 PM Last Post: Fenris |
|
| Setting the mouse location | Michael | 6 | 3,886 |
Jun 22, 2003 03:39 AM Last Post: reubert |
|
| mouse location woes | kelvin | 4 | 4,343 |
Dec 6, 2002 05:50 PM Last Post: wally |
|

