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!
How do you process input?
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement