Game console input
First of all, the console I'm talking about isn't a DOS window, it's the command line interface that appears in FPS games when you press ~
I've implemented a basic console for my engine, the problem I have right now is how to get input for it, I use DirectInput, which isn't based on messages like the Win32 API, I check keyboard and mouse input every frame, and respond to it, this works fine with input for moving around in the world, but it doesn't work at all for the console, because pressing a key would definitely last for more than one frame, repeating the character several times in the console, and I have to check all the keyboard keys every frame.
The only way I could come up with is checking all the keys every frame, and storing a cool-down period for each key, which doesn't sound that efficient to me, any other suggestions?
do something like the following:
what this will do is as long as the key is held down, it will only be processed once. This removes the ability of spamming the same characters to in a MP game by just holding down a char ;).
// your code
You should also trap the mouse this way.
A button is not pressed until it is down and up once - for menus.
Of course this would not work for say shooting in an FPS or other things but it does help in menus for DX.
Some major games out there have this flaw in their menus and it is so irritating. As well many games also allow you to hold down keys that I think give an unfair advantage - they should have checked which keys could be held down and what effect those would have on the game.
thanks guys for your posts, I was tinkering around with the buffered mode of DirectInput yesterday, it works in a similar way to Windows messages, I'll use immediate input for the game, and buffered input for the GUI.
thanks again :)