Re: [GD-Windows] GetAsyncKeyState / DI
Brought to you by:
vexxed72
From: Pierre T. <p.t...@wa...> - 2002-11-06 17:10:31
|
> The thing I don't like about GetAsyncKeyState is that you can loose keys > pressed between frames. Right, that's my main problem with it. > It also doesn't give you information about when a > key has been pressed or released. Here, I'm not sure you're right : // If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether // the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key // was pressed after the previous call to GetAsyncKeyState. Isn't it just the same as what you did ? key is down => KEY_ON key is up => KEY_OFF key was pressed after the previous call => KEY_BEGIN ...maybe KEY_END is missing, unless the LSB is correctly set in the KEY_OFF case as well... > if( Key[i].state&KEY_BEGIN ) > Key[i].state ^= KEY_BEGIN; Or simply : Key[i].state &= ~KEY_BEGIN; P. |