Does anyone know how to get any key state (pressed or no) by GetKeys function?
In other words how to handle this function:
bool result = isPressed(kVK_LeftArrow);
Thankyou.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
KeyMaptype is an array of integers but its real layout is a series of bits, one per key code. The bit number for a particular key is one less than the virtual key code.Since bit-shifting isn’t legal for very large values (e.g. you can’t just ask the compiler to shift 74 bits), the
KeyMaptype is broken into 4 parts. You need to take the virtual key code’s bit number and integer-divide by 32 to find the correct integer for the bit; then take the remainder to figure out which bit should be set.So, try this: