cl_keys.h File Reference

Header file for keyboard handler. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MAXKEYLINES   32

Enumerations

enum  keyNum_t {
  K_FIRST_KEY, K_BACKSPACE = 8, K_TAB = 9, K_ENTER = 13,
  K_PAUSE = 19, K_ESCAPE = 27, K_SPACE = 32, K_DEL = 127,
  K_MOUSE1 = 200, K_MOUSE2 = 201, K_MOUSE3 = 202, K_MWHEELDOWN = 239,
  K_MWHEELUP = 240, K_MOUSE4 = 241, K_MOUSE5 = 242, K_KP_INS = 256,
  K_KP_END = 257, K_KP_DOWNARROW = 258, K_KP_PGDN = 259, K_KP_LEFTARROW = 260,
  K_KP_5 = 261, K_KP_RIGHTARROW = 262, K_KP_HOME = 263, K_KP_UPARROW = 264,
  K_KP_PGUP = 265, K_KP_DEL = 266, K_KP_SLASH = 267, K_KP_MINUS = 269,
  K_KP_PLUS = 270, K_KP_ENTER = 271, K_KP_NUMLOCK = 272, K_UPARROW = 273,
  K_DOWNARROW = 274, K_RIGHTARROW = 275, K_LEFTARROW = 276, K_HOME = 278,
  K_END = 279, K_PGUP = 280, K_PGDN = 281, K_F1 = 282,
  K_F2 = 283, K_F3 = 284, K_F4 = 285, K_F5 = 286,
  K_F6 = 287, K_F7 = 288, K_F8 = 289, K_F9 = 290,
  K_F10 = 291, K_F11 = 292, K_F12 = 293, K_F13 = 294,
  K_F14 = 295, K_F15 = 296, K_INS = 277, K_SHIFT = 304,
  K_CTRL = 306, K_ALT = 308, K_JOY1, K_JOY2,
  K_JOY3, K_JOY4, K_JOY5, K_JOY6,
  K_JOY7, K_JOY8, K_JOY9, K_JOY10,
  K_JOY11, K_JOY12, K_JOY13, K_JOY14,
  K_JOY15, K_JOY16, K_JOY17, K_JOY18,
  K_JOY19, K_JOY20, K_JOY21, K_JOY22,
  K_JOY23, K_JOY24, K_JOY25, K_JOY26,
  K_JOY27, K_JOY28, K_JOY29, K_JOY30,
  K_JOY31, K_JOY32, K_AUX1, K_AUX2,
  K_AUX3, K_AUX4, K_AUX5, K_AUX6,
  K_AUX7, K_AUX8, K_AUX9, K_AUX10,
  K_AUX11, K_AUX12, K_AUX13, K_AUX14,
  K_AUX15, K_AUX16, K_NUMLOCK, K_SUPER,
  K_COMPOSE, K_MODE, K_HELP, K_PRINT,
  K_SYSREQ, K_SCROLLOCK, K_BREAK, K_MENU,
  K_EURO, K_UNDO, K_COMMAND, K_CAPSLOCK,
  K_POWER, K_APPS, K_LAST_KEY = 511, K_KEY_SIZE = 512
}
enum  msg_mode_t { MSG_SAY, MSG_SAY_TEAM }
enum  keyBindSpace_t { KEYSPACE_UI, KEYSPACE_GAME, KEYSPACE_BATTLE, KEYSPACE_MAX }

Functions

void Key_SetDest (int key_dest)
 Sets the keyDest in cls.
void Key_Event (unsigned int key, unsigned short unicode, qboolean down, unsigned time)
 Called by the system between frames for both key up and key down events.
void Key_Init (void)
void Key_WriteBindings (const char *filename)
 Writes lines containing "bind key value".
const char * Key_GetBinding (const char *binding, keyBindSpace_t space)
 Return the key binding for a given script command.
const char * Key_KeynumToString (int keynum)
 Convert a given keynum to string.
void Key_SetBinding (int keynum, const char *binding, keyBindSpace_t space)
 Bind a keynum to script command.

Variables

int msgMode
char msgBuffer [MAXCMDLINE]
size_t msgBufferLen
char keyLines [MAXKEYLINES][MAXCMDLINE]
int keyLinePos
int historyLine
int editLine
char * keyBindings [K_KEY_SIZE]
char * menuKeyBindings [K_KEY_SIZE]
char * battleKeyBindings [K_KEY_SIZE]

Detailed Description

Header file for keyboard handler.

Definition in file cl_keys.h.


Define Documentation

#define MAXKEYLINES   32

Definition at line 186 of file cl_keys.h.

Referenced by Con_LoadConsoleHistory(), Key_Console(), and Key_Init().


Enumeration Type Documentation

Enumerator:
KEYSPACE_UI 
KEYSPACE_GAME 
KEYSPACE_BATTLE 
KEYSPACE_MAX 

Definition at line 178 of file cl_keys.h.

enum keyNum_t
Enumerator:
K_FIRST_KEY 
K_BACKSPACE 
K_TAB 
K_ENTER 
K_P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at line 36 of file cl_keys.h.

enum msg_mode_t
Enumerator:
MSG_SAY 
MSG_SAY_TEAM 

Definition at line 173 of file cl_keys.h.


Function Documentation

void Key_Event ( unsigned int  key,
unsigned short  unicode,
qboolean  down,
unsigned  time 
)

Called by the system between frames for both key up and key down events.

Note:
Should NOT be called during an interrupt!
See also:
Key_Message

Definition at line 921 of file cl_keys.c.

References battleKeyBindings, Cbuf_AddText(), CL_OnBattlescape(), cls, Com_Error(), Com_sprintf(), Con_ToggleConsole_f(), ERR_FATAL, i, K_ESCAPE, K_KEY_SIZE, K_MOUSE1, K_MWHEELUP, Key_Console(), key_console, key_game, Key_Message(), key_message, keyBindings, client_static_s::keyDest, keyDown, MAX_STRING_CHARS, menuKeyBindings, mouseSpace, MS_UI, and UI_KeyPressed().

Referenced by IN_SendKeyEvents().

const char* Key_GetBinding ( const char *  binding,
keyBindSpace_t  space 
)

Return the key binding for a given script command.

Parameters:
[in] binding The script command to bind keynum to
See also:
Key_SetBinding
Returns:
the binded key or empty string if not found

Definition at line 573 of file cl_keys.c.

References battleKeyBindings, i, K_FIRST_KEY, K_LAST_KEY, Key_KeynumToString(), keyBindings, KEYSPACE_BATTLE, KEYSPACE_GAME, KEYSPACE_UI, menuKeyBindings, and Sys_Error().

Referenced by UI_GetReferenceString(), and UI_KeyBindingNodeKeyPressed().

void Key_Init ( void   ) 

Definition at line 872 of file cl_keys.c.

const char* Key_KeynumToString ( int  keynum  ) 

Convert a given keynum to string.

Parameters:
[in] keynum The keynum to convert to string
Returns:
a string (either a single ascii char, or a K_* name) for the given keynum.
Todo:
handle quote special (general escape sequence?)
See also:
Key_StringToKeynum

Todo:
use isprint here?

Definition at line 546 of file cl_keys.c.

References keyName_t::keynum, and keyName_t::name.

Referenced by CLMN_AddBindings(), IN_EventEnqueue(), Key_Bindlist_f(), Key_GetBinding(), Key_WriteBindings(), UI_KeyBindingNodeKeyPressed(), and UI_Tooltip().

void Key_SetBinding ( int  keynum,
const char *  binding,
keyBindSpace_t  space 
)

Bind a keynum to script command.

Parameters:
[in] keynum Converted from string to keynum
[in] binding The script command to bind keynum to
[in] space The key space to bind the key for (menu, game or battle)
See also:
Key_Bind_f
Key_StringToKeynum
Note:
If command is empty, this function will only remove the actual key binding instead of setting empty string.

Definition at line 610 of file cl_keys.c.

References battleKeyBindings, Com_DPrintf(), com_genericPool, DEBUG_CLIENT, K_KEY_SIZE, keyBindings, KEYSPACE_BATTLE, KEYSPACE_GAME, KEYSPACE_UI, Mem_Free, Mem_PoolStrDup, and menuKeyBindings.

Referenced by Key_Bind_f(), Key_Unbind_f(), Key_Unbindall_f(), and UI_KeyBindingNodeKeyPressed().

void Key_SetDest ( int  keyDest  ) 

Sets the keyDest in cls.

Parameters:
[in] keyDest see keydest_t

Definition at line 907 of file cl_keys.c.

References cls, key_console, client_static_s::keyDest, and UI_ReleaseInput().

Referenced by Con_Close(), Con_MessageModeSay_f(), Con_MessageModeSayTeam_f(), Con_ToggleChat_f(), Con_ToggleConsole_f(), Key_Message(), UI_PopWindow(), and UI_PushWindowDelete().

void Key_WriteBindings ( const char *  filename  ) 

Variable Documentation

char* battleKeyBindings[K_KEY_SIZE]
int editLine

Definition at line 43 of file cl_keys.c.

Referenced by Con_DrawInput(), Con_LoadConsoleHistory(), Key_ClearTyping(), and Key_Console().

Definition at line 44 of file cl_keys.c.

Referenced by Con_LoadConsoleHistory(), Con_SaveConsoleHistory(), and Key_Console().

char* keyBindings[K_KEY_SIZE]
Todo:
To support international keyboards nicely, we will need full support for binding to either
  • a unicode value, however achieved
  • a key
  • modifier + key with a priority system to decide which to try first. This will mean that cleverly-hidden punctuation keys will still have their expected effect, even if they have to be pressed as Shift-AltGr-7 or something. At the same time, it allows key combinations to be bound regardless of what their translated meaning is, so that for example Shift-4 can do something with the 4th agent regardless of which punctuation symbol is above the 4.

Definition at line 64 of file cl_keys.c.

Referenced by CLMN_InitKeyList_f(), Key_Bind_f(), Key_Bindlist_f(), Key_Event(), Key_GetBinding(), Key_SetBinding(), Key_Unbindall_f(), and Key_WriteBindings().

Definition at line 39 of file cl_keys.c.

Referenced by Con_DrawInput(), Key_ClearTyping(), Key_Console(), and Key_Init().

char keyLines[MAXKEYLINES][MAXCMDLINE]
char* menuKeyBindings[K_KEY_SIZE]
char msgBuffer[MAXCMDLINE]

Definition at line 47 of file cl_keys.c.

Referenced by Con_DrawNotify(), and Key_Message().

size_t msgBufferLen

Definition at line 48 of file cl_keys.c.

Referenced by Con_DrawNotify(), and Key_Message().

int msgMode

Generated by  doxygen 1.6.2