Hi Jim,
Smile. Yes, I know how DirectInput polls for keyboard input. I guess I 
should have been more specific what I meant.
In my games how I handle this problem with DirectX skipping menu items 
or polling too fast is I trap the keyboard states in a Boolean  array. 
If the array reports that the key is already being held down my input 
timer ignores the key. However, if the array shows the key is not down 
it will perform the action once and ignores future requests until the 
key is released and pressed again. Here is a little VB 2008 sample to 
show you what I mean.

' Poll keyboard state.
key = keyboard.GetCurrentKeyboardState()

' Down arrow was pressed.
If key[Key.Down] And keys]VK_Down] = False Then
keys[VK_Down] = True
MenuDown()
End If

' Down arrow is not being held down
' so release it in the keys array.
Else
keys[VK_Down] = False
End

' Up arrow was pressed.
If key.[Key.Up] And keys[VK_Up] = False Then
MenuUp()
End If

' Up arrow is not being held down
' so release it in the keys array.
Else
keys[VK_Up] = False
End

As a result of the code above if the keys array returns true the if 
statement will skip the keyboard action until the keys array returns 
false. Otherwise it will wait until the key in question is not being 
held down, and then take action on the next key press.
Hope that helps.

Jim Kitchen wrote:
> Hi Thomas,
> 
> Yes and no.  Some of the menus in Puppy1 such as adjust volume, adjust rate 
> of speech and change voice still use the VB6 keyboard input, because those 
> are chunks of code from before.  The main menus though are DirectX keyboard 
> input routines that I took from Homer on a Harley and just changed what they 
> say.
> 
> DirectX keyboard input does not have key presses and releases.  You simply 
> pole all keys or the keys that you are looking for being pressed and it 
> returns a value of the state of the key.
> 
> What I do and have always done is have a slight delay before poling for 
> another key press.  It is working perfectly for me in Puppy1 and Homer on a 
> Harley.  I guess though that the speed of some computers and fingers may make 
> a difference.  It really shouldn't though for the speed of the computer as 
> the delay routine should be constant regardless of computer speed.
> 
> Yes, sorry, I forgot that some computers do not have a right control key.  I, 
> as I did in Homer on a Harley will add for that the space bar does the same 
> as the right control key.
> 
> BFN


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to [EMAIL PROTECTED]
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/[EMAIL PROTECTED]
If you have any questions or concerns regarding the management of the list,
please send E-mail to [EMAIL PROTECTED]

Reply via email to