Max. Keycode #?

Started by , Wed 02/03/2005 03:56:39

Previous topic - Next topic

monkey0506

The maximum keycode referenced in the help manual is 434.  Will this likely be the highest keycode I will ever need?  I am asking because I am writing a function to return the key that is being pressed at any point in the game (to allow certain things to happen when on_key_press wouldn't normally be called), and I am trying to write a while loop to test all the keys that could be pressed so that I don't have to write out the same keycodes multiple times for my GetKeyPressed function and my on_key_press_always function and other places as well.  Thanks for any help.

Radiant

Yes, and you're likely not to need that one either.
Most of the 'interesting' keys are in the 32-127 range.

monkey0506

I figured I could just use the number of the highest keycode I will call in my on_key_press_always function, but then if I decide to add a key later (with a higher ASCII value), I might forget to change it in GetKeyPressed, so I reasoned that I may as well just test all the keys to be safe.  If it's not covered in on_key_press_always then it will just be ignored, so it doesn't really matter if I test them all.

Radiant

That's true; the speed dip is negligible.

SMF spam blocked by CleanTalk