Getting mouse location
Heh. It's a unichar (2 bytes)
2*8 = 16
2^16 = 65536
Unfortunately, the space is 32 and left arrow is around 63000, so I need the whole range. The 'game inputs' idea, though, is interesting. But I've found that it's not so slow. Using bzero to clear it and then just accessing it on demand isn't so bad, and I'll just assume that the user can spare a couple of kilobytes of RAM...
2*8 = 16
2^16 = 65536
Unfortunately, the space is 32 and left arrow is around 63000, so I need the whole range. The 'game inputs' idea, though, is interesting. But I've found that it's not so slow. Using bzero to clear it and then just accessing it on demand isn't so bad, and I'll just assume that the user can spare a couple of kilobytes of RAM...
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?
keyCode is an unsigned short (not a unichar), but since it's the same as the Carbon Events keyCode, there's only 128 different possible values (the same as the 128 bitfields of a KeyMap).
You don't want to treat it as a character, anyway, since you want to treat b, shift-b, option-b and option-shift-b identically.
You don't want to treat it as a character, anyway, since you want to treat b, shift-b, option-b and option-shift-b identically.
Ok, well the way I get it is from the NSEvent. The charactersIgnoringModifers thingy returns an NSString, and characterAtIndex gets a unichar. And, whether it's an unsigned short or a unichar, they're both 2 bytes.
And, by sending it through lowercaseString, it does treat them the same.
And, by sending it through lowercaseString, it does treat them the same.
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?
Right, but if someone has a Japanese input method 
If you send -keyCode to the event, you'll get the scan code for the key that was pressed. AFAIK, that's not guaranteed to be portable across keyboards, but AFAIK it's been the same since 1984...
It's also guaranteed that one keyCode == one keypress, which isn't guaranteed by the charactersIgnoringModifiers method.
It also allows you to distinguish between the numeric keypad and the number keys, for example, and between enter and return...

If you send -keyCode to the event, you'll get the scan code for the key that was pressed. AFAIK, that's not guaranteed to be portable across keyboards, but AFAIK it's been the same since 1984...
It's also guaranteed that one keyCode == one keypress, which isn't guaranteed by the charactersIgnoringModifiers method.
It also allows you to distinguish between the numeric keypad and the number keys, for example, and between enter and return...
Okie dokie, sounds good to me 
Maybe I'll include both, and have the charactersIgnoringModifers as a 'compatibility' mode

Maybe I'll include both, and have the charactersIgnoringModifers as a 'compatibility' mode
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?
Hrm, one more thing: how do I convert a char to a keycode and vice versa?
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?
Well, uh, extract the appropriate STR# resource from the Marathon application...
No easy way.
You can send -charactersIgnoringModifiers to the same event you send -keyCode to for a guess, but you'll still have to hard code certain values.
There's a Carbon function called KeyTranslate or something like that which gets you some of the way there...
No easy way.
You can send -charactersIgnoringModifiers to the same event you send -keyCode to for a guess, but you'll still have to hard code certain values.
There's a Carbon function called KeyTranslate or something like that which gets you some of the way there...
Quote:Originally posted by OneSadCookie
Well, uh, extract the appropriate STR# resource from the Marathon application...
Well, that didn't get me very far...
But, I did find some cool strings...
Quote:The guy with the iMac was going to play, but he was abducted by aliens
I didn't find Paco, so he didn't receive the map. No network game until somebody finds him.
The guy gathering the game decided he have better things to do with his life. Like listening to polka!
That guy over there have a different version of M1. So I kick his ass.
Now waiting to be gathered into a network game by a server. Click ìCancelî to let everyone know you're a coward.
Delivering pizza to the other guy.
Sending secret virus to the bunch of losers.
You got mail!.
Waiting for server to haul ass.
Sending environment information to your mom.
Sending naked pictures of your mom to everyone else.
Another zillion bytes and we're ready to go!
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?
Maybe it's only in M2/M∞
Actually, that was from Aleph One. (I couldn't find the original
)
)
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?
There's a table in one of the SDL headers, and on in Inside Macintosh which might still be findable somewhere in the Carbon docs...
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| ending location from angle and speed | Kazooless | 5 | 3,934 |
Apr 3, 2009 02:40 PM Last Post: Gillissie |
|
| polling mouse location? | alloca | 1 | 2,213 |
Jan 22, 2009 04:14 PM Last Post: ThemsAllTook |
|
| Cocoa: Mouse location while dragging window | Fenris | 4 | 4,496 |
Jul 14, 2005 04:46 PM Last Post: Fenris |
|
| Setting the mouse location | Michael | 6 | 3,889 |
Jun 22, 2003 03:39 AM Last Post: reubert |
|
| mouse location woes | kelvin | 4 | 4,348 |
Dec 6, 2002 05:50 PM Last Post: wally |
|

