in_namePressed: Only print key name on down events; document it

This commit is contained in:
Daniel Gibson 2024-03-25 02:31:07 +01:00
parent 3504e693bf
commit 9ccce9b4b6
2 changed files with 7 additions and 4 deletions

View file

@ -159,6 +159,9 @@ This can be configured with the following CVars:
from the OS like Alt-Tab or Windows Key won't work and thus not accidentally interrupt your playing.
Defaults to `0`.
- `in_namePressed` if set to `1`, the currently pressed key/button (on keyboard/mouse/gamepad)
is printed to the console - useful when setting key-bindings in the console or a config. Default is `0`.
- `in_kbd` allows you to set your keyboard layout so the console key works better. Mostly useful with SDL1.2
- `in_tty` tab completion and history for input from the **terminal** (on Unix-likes, like Linux, macOS, BSD, ...)

View file

@ -760,8 +760,8 @@ Called by the system for both key up and key down events
void idKeyInput::PreliminaryKeyEvent( int keynum, bool down ) {
keys[keynum].down = down;
if( cvarSystem->GetCVarBool( "in_namePressed") ) {
KeyReveal( keynum );
if( down && in_namePressed.GetBool() ) {
KeyReveal( keynum );
}
#ifdef ID_DOOM_LEGACY
@ -789,8 +789,8 @@ simple print in the console the name of the key pressed
===================
*/
void idKeyInput::KeyReveal( int keyNum ) {
const char* keyName = KeyNumToString( keyNum, false );
common->Printf( "pressed the \"%s\" key.\n", keyName );
const char* keyName = KeyNumToString( keyNum, false );
common->Printf( "pressed the \"%s\" key.\n", keyName );
}
/*