Direct Input?!
How would you detect a key is down, and only take action for that down once? (once action per keypress) since DirectInput just return the state of the key.
I tried
if ((m_kKeyboard.IsButtonDown (DIK_SPACE))&&(m_fSpace==FALSE))
{
DO SOMETHING;
}
to check if the key is down and take action here(where m_fSpace is just a flag), then
if (m_kKeyboard.IsButtonUp (DIK_SPACE))
m_fSpace=FALSE;
to reset the flag
But when it come to running, I add a breakpoint to DO SOMETHING, my application break as soon as I start it. What is my problem?
The funny (and flustraiting ) thing is I did quite a lots loop in my program when I remove some It run OK again!
Anyone has any idea pls help! Thx
[edited by - kanguru on August 14, 2002 4:53:32 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement