Quote:Original post by Mybowlcut
I made an interface class called Updateable that returns void and takes no parameters. This means that each class that derives from Updateable needs to be able to get the lass keypress through peek_keypress (because it doesn't have any parameters to use - which is what I prefer). So:
GAME LOOP
GET_KEYPRESS() (USER PRESSES A KEY)
OBJECT.UPDATE() (CALLS PEEK_KEYPRESS)
OBJECT.DRAW()
GAME LOOP
Hope that clears things up.
OK. But..
ReadConsoleInput will wait for an input, process it and remove it from the inputbuffer. What do you expect to be able to Peek in your update function?
If you're simply trying to poll and maintain an input state ( with a one keystroke history? ) you should look into a different scheme for doing so.
You can simply use #PeekConsoleInput to find out how many events are pending to be processed and then process each one of them and maintain an inputstate in your base class which derived classes can access. You can simply use boolean fields for all the keys and update them on key up/down events.
Another way is to use direct input and and use the direct input device state to create a snapshot of the input state each game-loop-frame.
If you're trying to serialize the input.. ignore the above, and just use a queue :D
---
Not sure if thats what you wanted..
- K
--------------------------------------"Those alien bastards are gonna pay for ruining my ride !"