according to the api reference, getasynckeystate can be used to check for keypresses. i've figured out how to check for a single keypress, but i don't know how to check if a key has been pressed again after the first time (like a toggle). i was wondering if anyone could explain it to me?
Posted on 2001-01-26 09:44:00 by careb
I'm not sure if I understand... but make a variable that is false at start and when button is pressed you change it to true. When your variable is true you know that button is pressed again. Or do a counter that is incremented at every press, then you know how many times user presses that button. This message was edited by SamiP, on 1/26/2001 11:31:42 AM
Posted on 2001-01-26 11:30:00 by SamiP
thanks for the reply, i'll implement your thoughts and see if it works
Posted on 2001-01-27 02:47:00 by careb
since we're on this subject, does anyone know what exactly most and least significant bit mean (from the api reference)? i suppose it's a return value of some sort, but how do you identify it?
Posted on 2001-01-27 03:00:00 by soulb
Most significant bit - the high part of the return value. Least significant bit - the low part of the return value. In GetAsyncKeyState()'s case, al is least significant and ah is most significant. Think about it this way - if you have increase al by one, ax will increase by one as well. But if you increase ah, ax will increase by 16. So what is more significant? al or ah? The high part (ah) is more significant. That's in 16-bit asm. In 32-bit asm its (ax) and (ax after rol eax, 16). Even though GetAsyncKeyState() is supposed to be 32-bit, you deal with its return value as if it was 16-bit, if I am not mistaken. comrade
Posted on 2001-01-27 19:19:00 by comrade