How do I test for KeyUp in DirectInput? The problem is that I want to add a pause ability to my game, let's say by pressing the key "P". But when I test for the key and the 0x80 bit it will just be as if the key was repeatedly pressed and will pause, unpause, pause, unpause.
How do I solve this?
Edited by - vbisme on 8/22/00 7:11:40 PM
If you know how to test for key down, you should be able to test for key up. eg.
if (!keys[DIK_LEFT]){
// left key is up...
}
Hope that helps.
- Daniel
VG Games
if (!keys[DIK_LEFT]){
// left key is up...
}
Hope that helps.
- Daniel
VG Games
- DanielMy homepage
You have to make a variable (like a bool, or an element of a bit field or something) that holds the current pressed-state for each key, like this:
That''s how I do it anyway...
if(KEYDOWN(PAUSE_KEY) && !pauseKeyPressed){ // pause the game}else if(!KEYDOWN(PAUSE_KEY)) pauseKeyPressed = false;
That''s how I do it anyway...
Judging by your name, I think you are using Visual Basic, yes?
Ok, well for me, I don''t see the point for using DInput in VB when the Windows API combined with the Visual Basic events will do the same job much easier, to save on developement time, just use the KeyUp event provided and call a sub. It is a lot easier and does practically the same job.
hth
"Only a fool quotes himself"
Andy Owen
My Homepage (Non games related)
My Current Project (Games related... I think)
Ok, well for me, I don''t see the point for using DInput in VB when the Windows API combined with the Visual Basic events will do the same job much easier, to save on developement time, just use the KeyUp event provided and call a sub. It is a lot easier and does practically the same job.
hth
"Only a fool quotes himself"
Andy Owen
My Homepage (Non games related)
My Current Project (Games related... I think)
Trying is the first step towards failure.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement