How do you process input?

Started by
5 comments, last by Bow_vernon 13 years, 1 month ago
I have a buffer for keypress, now Id like to relate it to my game. But Id like to know people thought/experience, since experience is the best teacher, so coders, please share your thought and experiences here...and also if you know any good links, please share it here...Help me help others
Cheers!
Advertisement
I get the keypress as a character and use it t call a Lua function in an input script file, via the standard getglobal/push arguments/pcall approach.
So you run a script at every keypress?
No, I run a function at every keypress.
Whenever I process messages, I fill a [font="Courier New"]BOOL keypress[256][/font] array with the states of every key. I pass a pointer to that array to every object that accepts input. That object checks whatever keys are relevant and acts appropriately.

It needs work.

When a key press is detected, it is passed to a part of the code for processing. That code translates the key press into a command for the game. The game logic step handles these commands. For example, the escape key generates an "Exit" command. The game logic step receives the "Exit" command and shuts down the game.
Ok thx. I think I got it. Wonder how those 'big' games did it...

This topic is closed to new replies.

Advertisement