15
Jun
Just a really quick snippet today.
Jailbreak has reworked the weapon selection HUD, and as part of this there are two special weapons that have special keys; the Grav Gun and the Medi-Gun.
As some of our testers use non-standard key configurations, they’ve been whinging at me to make sure that the key that’s overlaid on top of the weapon, to let you know what key to press, should be updated based on the current config.
After a little digging around, I found that you can get a key for a given binding quite easily:
1 | const char *key = engine->Key_LookupBinding( "phys_swap" ); |
Just replace “phys_swap” with the command you want to know the key for and you’re done!
June 15th, 2009 at 9:46 pm
What is returned if no key is bound to the command?
July 28th, 2009 at 3:30 pm
It’d probably be a null pointer.
November 17th, 2009 at 11:38 am
Tried using this today, does this work with keys like F1, F2, etc? For two different fonts I seem to get some weird symbol while keys with only 1 char do work.