Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GetKeys() and KeyMap?



In a message dated 7/27/04 11:12:48 PM, email@hidden writes:


>> Good.
>> (my problem was I was thinking Boolean not Bit)
>
>Stop assuming so much and do some research and reading. A Boolean occupies
>one byte. A KeyMap is an array of four longs = 16. How could you think
>16
>bytes could hold 128 1-byte Booleans?

And I quote for the Event Manager
"The KeyMap type is interpreted as an array of 128 elements,
each having a Boolean value."

(like I said I was thinking Boolean storage not Bit storage)


>You need to take some time to learn what you're doing. This business of
>just
>trying stuff when you don't even understand bits and bytes and other basic
>concepts is just a waste of time.

In both my C++ tutorials "bits and bytes" don't even apear until
after ALL the Object Orient Programming.
Which O.O.P. is NOT basic.



>keys is is a long*, so you're shifting a pointer. What are you really trying
>to do here?

Events.h and the reference don't say
it's a pointer.
(But I understand it's a pointer now)



>Good grief. Notice that: 128 - (128 - 24) = 24.
Strike three!
My Brain is officially FRIED




>The carbon-dev list isn't a Bare Essentials of Programming list, nor is
>it a
>Programming Tutorial list. You need to learn the basics of programming
>or
>you'll wasted gobs of time and constantly be frustrated trying to write
>software. Really, do *yourself* a favor and figure those things out.

I figured how to port the other functions.
(with some trouble)





In a message dated 7/28/04 11:33:14 AM, email@hidden writes:

>// inKeyCode = any keyboard scan code, 0-127
>Boolean isPressed(unsigned short inKeyCode)
>{
> unsigned char keyMap[16];
>
> GetKeys((UInt32*) &keyMap);
> return (0 != ((keyMap[ inKeyCode >> 3] >> ( inKeyCode & 7)) & 1));
>}
VERY Impressive!





Thanks ;)
BinarySpike
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.