UFO: Alien Invasion
|
Client input handling - bindable commands. More...
#include "../client.h"
#include "cl_input.h"
#include "cl_keys.h"
#include "cl_joystick.h"
#include "../battlescape/cl_localentity.h"
#include "../battlescape/cl_hud.h"
#include "../cl_console.h"
#include "../cl_screen.h"
#include "../battlescape/cl_actor.h"
#include "../battlescape/cl_view.h"
#include "../battlescape/cl_parse.h"
#include "../ui/ui_main.h"
#include "../ui/ui_input.h"
#include "../ui/node/ui_node_abstractnode.h"
#include "../../shared/utf8.h"
#include "../../common/tracing.h"
#include "../renderer/r_misc.h"
Go to the source code of this file.
Data Structures | |
struct | kbutton_t |
struct | cursorChange_s |
Macros | |
#define | MAX_KEYQ 64 |
#define | SCROLL_BORDER 4 |
#define | MOUSE_YAW_SCALE 0.1 |
#define | MOUSE_PITCH_SCALE 0.1 |
Typedefs | |
typedef struct cursorChange_s | cursorChange_t |
Enumerations | |
enum | { BATTLESCAPE_MOUSE_DRAGGING_TRIGGER_X = VID_NORM_WIDTH / 10, BATTLESCAPE_MOUSE_DRAGGING_TRIGGER_Y = VID_NORM_HEIGHT / 10 } |
Variables | |
struct { | |
unsigned int key | |
unsigned short unicode | |
int down | |
} | keyq [MAX_KEYQ] |
static int | keyq_head = 0 |
static int | keyq_tail = 0 |
static cvar_t * | in_debug |
cvar_t * | cl_isometric |
mouseSpace_t | mouseSpace |
int | mousePosX |
int | mousePosY |
static int | oldMousePosX |
static int | oldMousePosY |
static int | battlescapeMouseDraggingX |
static int | battlescapeMouseDraggingY |
static bool | battlescapeMouseDraggingPossible |
static bool | battlescapeMouseDraggingActive |
static kbutton_t | in_turnleft |
static kbutton_t | in_turnright |
static kbutton_t | in_shiftleft |
static kbutton_t | in_shiftright |
static kbutton_t | in_shiftup |
static kbutton_t | in_shiftdown |
static kbutton_t | in_zoomin |
static kbutton_t | in_zoomout |
static kbutton_t | in_turnup |
static kbutton_t | in_turndown |
static kbutton_t | in_pantilt |
static cursorChange_t | cursorChange |
Client input handling - bindable commands.
When a key event issues a button command (+forward, +attack, etc), it appends its key number as a parameter to the command so it can be matched up with the release.
Key_Event(unsigned int key, unsigned short unicode, bool down, unsigned time);
+mlook src time
Definition in file cl_input.cpp.
#define MAX_KEYQ 64 |
Definition at line 61 of file cl_input.cpp.
Referenced by IN_EventEnqueue(), and IN_SendKeyEvents().
#define MOUSE_PITCH_SCALE 0.1 |
Definition at line 541 of file cl_input.cpp.
Referenced by CL_GetKeyMouseState().
#define MOUSE_YAW_SCALE 0.1 |
Definition at line 540 of file cl_input.cpp.
Referenced by CL_GetKeyMouseState().
#define SCROLL_BORDER 4 |
Definition at line 539 of file cl_input.cpp.
Referenced by CL_GetKeyMouseState().
typedef struct cursorChange_s cursorChange_t |
anonymous enum |
Enumerator | |
---|---|
BATTLESCAPE_MOUSE_DRAGGING_TRIGGER_X | |
BATTLESCAPE_MOUSE_DRAGGING_TRIGGER_Y |
Definition at line 86 of file cl_input.cpp.
Middle mouse click.
Definition at line 424 of file cl_input.cpp.
References CL_OnBattlescape(), and IN_KeyDown().
Referenced by IN_Init().
Definition at line 431 of file cl_input.cpp.
References CL_ActorActionMouse(), IN_GetMouseSpace, IN_KeyUp(), IN_SetMouseSpace(), MS_NULL, MS_UI, and kbutton_t::msec.
Referenced by IN_Init().
float CL_GetKeyMouseState | ( | int | dir | ) |
Definition at line 546 of file cl_input.cpp.
References MOUSE_PITCH_SCALE, MOUSE_YAW_SCALE, mousePosX, mousePosY, oldMousePosX, oldMousePosY, viddef_t::rx, viddef_t::ry, SCROLL_BORDER, kbutton_t::state, STATE_FORWARD, STATE_RIGHT, STATE_ROT, STATE_TILT, STATE_ZOOM, viddef, viddef_t::viewHeight, viddef_t::viewWidth, viddef_t::x, and viddef_t::y.
Referenced by CL_CameraMove().
Definition at line 462 of file cl_input.cpp.
References CL_BattlescapeRunning(), and UI_PushWindow().
Referenced by IN_Init().
Definition at line 472 of file cl_input.cpp.
References CL_BattlescapeRunning(), and UI_CloseWindow().
Referenced by IN_Init().
Left mouse button is hit in menu.
Definition at line 522 of file cl_input.cpp.
References IN_GetMouseSpace, K_MOUSE1, mousePosX, mousePosY, MS_UI, and UI_MouseDown().
Referenced by IN_Init().
Left mouse button is freed in menu.
Definition at line 532 of file cl_input.cpp.
References IN_GetMouseSpace, K_MOUSE1, mousePosX, mousePosY, MS_UI, and UI_MouseUp().
Referenced by IN_Init().
Switch one worldlevel down.
Definition at line 349 of file cl_input.cpp.
References CL_OnBattlescape(), cl_worldlevel, Cvar_SetValue(), and cvar_s::integer.
Referenced by IN_Init().
Switch one worldlevel up.
Definition at line 339 of file cl_input.cpp.
References cl, CL_OnBattlescape(), cl_worldlevel, Cvar_SetValue(), cvar_s::integer, and clientBattleScape_s::mapMaxLevel.
Referenced by IN_Init().
Middle mouse button is hit in menu.
Definition at line 502 of file cl_input.cpp.
References IN_GetMouseSpace, K_MOUSE3, mousePosX, mousePosY, MS_UI, and UI_MouseDown().
Referenced by IN_Init().
Middle mouse button is freed in menu.
Definition at line 512 of file cl_input.cpp.
References IN_GetMouseSpace, K_MOUSE3, mousePosX, mousePosY, MS_UI, and UI_MouseUp().
Referenced by IN_Init().
Simulate press of a key with a command.
Definition at line 1175 of file cl_input.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), IN_EventEnqueue(), and Key_StringToKeynum().
Referenced by IN_Init().
Definition at line 407 of file cl_input.cpp.
References BATTLESCAPE_MOUSE_DRAGGING_TRIGGER_X, BATTLESCAPE_MOUSE_DRAGGING_TRIGGER_Y, battlescapeMouseDraggingActive, battlescapeMouseDraggingPossible, battlescapeMouseDraggingX, battlescapeMouseDraggingY, CL_BattlescapeMouseDragging(), mousePosX, and mousePosY.
Referenced by IN_Frame().
Right mouse button is hit in menu.
Definition at line 482 of file cl_input.cpp.
References IN_GetMouseSpace, K_MOUSE2, mousePosX, mousePosY, MS_UI, and UI_MouseDown().
Referenced by IN_Init().
Right mouse button is freed in menu.
Definition at line 492 of file cl_input.cpp.
References IN_GetMouseSpace, K_MOUSE2, mousePosX, mousePosY, MS_UI, and UI_MouseUp().
Referenced by IN_Init().
Left mouse click.
Definition at line 379 of file cl_input.cpp.
References battlescapeMouseDraggingActive, battlescapeMouseDraggingPossible, battlescapeMouseDraggingX, battlescapeMouseDraggingY, CL_BattlescapeRunning(), CL_InitBattlescapeMouseDragging(), IN_GetMouseSpace, mousePosX, mousePosY, and MS_UI.
Referenced by IN_Init().
Definition at line 390 of file cl_input.cpp.
References battlescapeMouseDraggingActive, battlescapeMouseDraggingPossible, CL_ActorSelectMouse(), IN_GetMouseSpace, IN_SetMouseSpace(), MS_NULL, MS_UI, and MS_WORLD.
Referenced by IN_Init().
Turn button is hit.
Definition at line 444 of file cl_input.cpp.
References CL_ActorTurnMouse(), IN_GetMouseSpace, MS_UI, and MS_WORLD.
Referenced by IN_Init().
Definition at line 452 of file cl_input.cpp.
References IN_GetMouseSpace, IN_SetMouseSpace(), MS_NULL, and MS_UI.
Referenced by IN_Init().
Definition at line 361 of file cl_input.cpp.
References CL_CameraZoomOut().
Referenced by IN_Init().
Definition at line 905 of file cl_input.cpp.
References Com_Printf(), cvar_s::integer, Key_KeynumToString(), keyDown, keyq, keyq_head, and MAX_KEYQ.
Referenced by CL_PressKey_f(), IN_Frame(), and IN_JoystickMove().
Handle input events like key presses and joystick movement as well as window events.
Definition at line 946 of file cl_input.cpp.
References CL_ProcessMouseDragging(), cls, Cmd_ExecuteString(), Com_Printf(), Con_ToggleConsole_f(), Cvar_SetValue(), IN_EventEnqueue(), IN_JoystickMove(), IN_Parse(), IN_PrintKey(), IN_ToggleFullscreen(), IN_TranslateKey(), cvar_s::integer, K_AUX1, K_MOUSE1, K_MOUSE2, K_MOUSE3, K_MOUSE4, K_MOUSE5, K_MWHEELDOWN, K_MWHEELUP, key, cvar_s::modified, mousePosX, mousePosY, oldMousePosX, oldMousePosY, R_ReinitOpenglContext(), viddef_t::rx, viddef_t::ry, UI_ReleaseInput(), unicode, UTF8_next(), vid_fullscreen, vid_grabmouse, vid_mode, and viddef.
Referenced by CL_Frame().
Definition at line 1212 of file cl_input.cpp.
References CL_ActionDown_f(), CL_ActionUp_f(), CL_HudRadarDown_f(), CL_HudRadarUp_f(), CL_LeftClickDown_f(), CL_LeftClickUp_f(), CL_LevelDown_f(), CL_LevelUp_f(), CL_MiddleClickDown_f(), CL_MiddleClickUp_f(), CL_PressKey_f(), CL_RightClickDown_f(), CL_RightClickUp_f(), CL_SelectDown_f(), CL_SelectUp_f(), CL_TurnDown_f(), CL_TurnUp_f(), CL_WheelDown_f(), CL_WheelUp_f(), CL_ZoomInQuant_f(), CL_ZoomOutQuant_f(), Cmd_AddCommand(), Com_Printf(), CVAR_ARCHIVE, Cvar_Get(), IN_PanTiltDown_f(), IN_PanTiltUp_f(), IN_ShiftDownDown_f(), IN_ShiftDownUp_f(), IN_ShiftLeftDown_f(), IN_ShiftLeftDownDown_f(), IN_ShiftLeftDownUp_f(), IN_ShiftLeftUp_f(), IN_ShiftLeftUpDown_f(), IN_ShiftLeftUpUp_f(), IN_ShiftRightDown_f(), IN_ShiftRightDownDown_f(), IN_ShiftRightDownUp_f(), IN_ShiftRightUp_f(), IN_ShiftRightUpDown_f(), IN_ShiftRightUpUp_f(), IN_ShiftUpDown_f(), IN_ShiftUpUp_f(), IN_StartupJoystick(), IN_TurnDownDown_f(), IN_TurnDownUp_f(), IN_TurnLeftDown_f(), IN_TurnLeftUp_f(), IN_TurnRightDown_f(), IN_TurnRightUp_f(), IN_TurnUpDown_f(), IN_TurnUpUp_f(), IN_ZoomInDown_f(), IN_ZoomInUp_f(), IN_ZoomOutDown_f(), IN_ZoomOutUp_f(), mousePosX, mousePosY, and N_.
Referenced by CL_InitLocal().
Handles the catch of a kbutton_t
state.
Definition at line 117 of file cl_input.cpp.
References CL_Milliseconds(), Cmd_Argv(), Com_Printf(), kbutton_t::down, kbutton_t::downtime, and kbutton_t::state.
Referenced by CL_ActionDown_f(), IN_PanTiltDown_f(), IN_ShiftDownDown_f(), IN_ShiftLeftDown_f(), IN_ShiftLeftDownDown_f(), IN_ShiftLeftUpDown_f(), IN_ShiftRightDown_f(), IN_ShiftRightDownDown_f(), IN_ShiftRightUpDown_f(), IN_ShiftUpDown_f(), IN_TurnDownDown_f(), IN_TurnLeftDown_f(), IN_TurnRightDown_f(), IN_TurnUpDown_f(), IN_ZoomInDown_f(), and IN_ZoomOutDown_f().
Handles the release of a kbutton_t
state.
[in,out] | b | the button state to |
Definition at line 163 of file cl_input.cpp.
References Cmd_Argv(), kbutton_t::down, kbutton_t::downtime, kbutton_t::msec, and kbutton_t::state.
Referenced by CL_ActionUp_f(), IN_PanTiltUp_f(), IN_ShiftDownUp_f(), IN_ShiftLeftDownUp_f(), IN_ShiftLeftUp_f(), IN_ShiftLeftUpUp_f(), IN_ShiftRightDownUp_f(), IN_ShiftRightUp_f(), IN_ShiftRightUpUp_f(), IN_ShiftUpUp_f(), IN_TurnDownUp_f(), IN_TurnLeftUp_f(), IN_TurnRightUp_f(), IN_TurnUpUp_f(), IN_ZoomInUp_f(), and IN_ZoomOutUp_f().
Definition at line 236 of file cl_input.cpp.
References IN_GetMouseSpace, IN_KeyDown(), and MS_WORLD.
Referenced by IN_Init().
Called every frame to parse the input.
Definition at line 584 of file cl_input.cpp.
References ca_active, CL_ActorMouseTrace(), cls, IN_SetMouseSpace(), MS_NULL, MS_UI, MS_WORLD, client_static_s::state, UI_IsMouseOnWindow(), viddef, viddef_t::viewHeight, and viddef_t::viewWidth.
Referenced by IN_Frame().
Debug function to print sdl key events.
Definition at line 609 of file cl_input.cpp.
References Com_Printf(), cvar_s::integer, and unicode.
Referenced by IN_Frame().
Definition at line 1284 of file cl_input.cpp.
References CL_Milliseconds(), down, key, Key_Event(), keyq, keyq_head, keyq_tail, MAX_KEYQ, and unicode.
Referenced by CL_SendCommand().
void IN_SetMouseSpace | ( | mouseSpace_t | mspace | ) |
Definition at line 1195 of file cl_input.cpp.
References cursorChange_s::cursor, Cvar_GetValue(), mouseSpace, MS_NULL, cursorChange_s::prevSpace, and SCR_ChangeCursor().
Referenced by CL_ActionUp_f(), CL_ActorUseHeadgear_f(), CL_SelectUp_f(), CL_TurnUp_f(), and IN_Parse().
|
static |
Translate the keys to ufo keys.
Definition at line 630 of file cl_input.cpp.
References K_ALT, K_BACKSPACE, K_BREAK, K_CAPSLOCK, K_COMPOSE, K_CTRL, K_DEL, K_DOWNARROW, K_END, K_ENTER, K_ESCAPE, K_EURO, K_F1, K_F10, K_F11, K_F12, K_F13, K_F14, K_F15, K_F2, K_F3, K_F4, K_F5, K_F6, K_F7, K_F8, K_F9, K_HELP, K_HOME, K_INS, K_KP_5, K_KP_DEL, K_KP_DOWNARROW, K_KP_END, K_KP_ENTER, K_KP_HOME, K_KP_INS, K_KP_LEFTARROW, K_KP_MINUS, K_KP_MULTIPLY, K_KP_NUMLOCK, K_KP_PGDN, K_KP_PGUP, K_KP_PLUS, K_KP_RIGHTARROW, K_KP_SLASH, K_KP_UPARROW, K_LEFTARROW, K_MENU, K_MODE, K_PAUSE, K_PGDN, K_PGUP, K_POWER, K_PRINT, K_RIGHTARROW, K_SCROLLOCK, K_SHIFT, K_SPACE, K_SUPER, K_SYSREQ, K_TAB, K_UNDO, K_UPARROW, Key_IsNumlock(), and UTF8_encoded_len().
Referenced by IN_Frame().
|
static |
Definition at line 85 of file cl_input.cpp.
Referenced by CL_ProcessMouseDragging(), CL_SelectDown_f(), and CL_SelectUp_f().
|
static |
Definition at line 85 of file cl_input.cpp.
Referenced by CL_ProcessMouseDragging(), CL_SelectDown_f(), and CL_SelectUp_f().
|
static |
Definition at line 83 of file cl_input.cpp.
Referenced by CL_ProcessMouseDragging(), and CL_SelectDown_f().
|
static |
Definition at line 84 of file cl_input.cpp.
Referenced by CL_ProcessMouseDragging(), and CL_SelectDown_f().
cvar_t* cl_isometric |
Definition at line 77 of file cl_input.cpp.
Referenced by CL_CameraMove(), CL_GetWorldCoordsUnderMouse(), CL_ViewCalcFieldOfViewX(), and SEQ_SetCamera().
|
static |
Definition at line 1193 of file cl_input.cpp.
int down |
Definition at line 70 of file cl_input.cpp.
Referenced by Check_SidePointsDown(), IN_SendKeyEvents(), Key_Event(), uiMaterialEditorNode::onScroll(), uiMessageListNode::onScroll(), uiOptionTreeNode::onScroll(), uiOptionListNode::onScroll(), uiTextNode::onScroll(), uiGeoscapeNode::onScroll(), and uiSpinnerNode::onScroll().
|
static |
Definition at line 76 of file cl_input.cpp.
|
static |
Definition at line 108 of file cl_input.cpp.
|
static |
Definition at line 105 of file cl_input.cpp.
|
static |
Definition at line 104 of file cl_input.cpp.
|
static |
Definition at line 104 of file cl_input.cpp.
|
static |
Definition at line 105 of file cl_input.cpp.
|
static |
Definition at line 107 of file cl_input.cpp.
|
static |
Definition at line 104 of file cl_input.cpp.
|
static |
Definition at line 104 of file cl_input.cpp.
|
static |
Definition at line 107 of file cl_input.cpp.
|
static |
Definition at line 106 of file cl_input.cpp.
|
static |
Definition at line 106 of file cl_input.cpp.
unsigned int key |
Definition at line 68 of file cl_input.cpp.
Referenced by AddEpair(), CL_ParseMapParticle(), Com_ParseTerrainDefinition(), CON_FlushIn(), HASH_Insert(), IN_Frame(), IN_SendKeyEvents(), Info_Print(), Key_Console(), Key_Event(), Key_IsDown(), ParseEpair(), ParseMapEntity(), Sys_ConsoleInput(), Sys_TTYDeleteCharacter(), UI_SetKeyBindingEx(), UI_Tooltip(), and UnparseEntities().
struct { ... } keyq[MAX_KEYQ] |
Referenced by IN_EventEnqueue(), and IN_SendKeyEvents().
|
static |
Definition at line 73 of file cl_input.cpp.
Referenced by IN_EventEnqueue(), and IN_SendKeyEvents().
|
static |
Definition at line 74 of file cl_input.cpp.
Referenced by IN_SendKeyEvents().
int mousePosX |
Definition at line 80 of file cl_input.cpp.
Referenced by CL_GetKeyMouseState(), CL_GetWorldCoordsUnderMouse(), CL_LeftClickDown_f(), CL_LeftClickUp_f(), CL_MiddleClickDown_f(), CL_MiddleClickUp_f(), CL_ProcessMouseDragging(), CL_RightClickDown_f(), CL_RightClickUp_f(), CL_SelectDown_f(), uiVScrollbarNode::draw(), uiTabNode::draw(), uiSpinnerNode::draw(), uiEditorNode::drawOverWindow(), HUD_DrawMouseCursorText(), HUD_UpdateCursor(), IN_Frame(), IN_Init(), IN_JoystickMove(), uiGeoscapeNode::onCapturedMouseMove(), uiContainerNode::onDndMove(), uiEditorNode::onMouseDown(), SCR_DrawCursor(), UI_CheckMouseMove(), UI_DNDDrop(), UI_Draw(), UI_DrawCursor(), UI_DrawDragAndDrop(), and UI_PushDropDownWindow_f().
int mousePosY |
Definition at line 80 of file cl_input.cpp.
Referenced by CL_GetKeyMouseState(), CL_GetWorldCoordsUnderMouse(), CL_LeftClickDown_f(), CL_LeftClickUp_f(), CL_MiddleClickDown_f(), CL_MiddleClickUp_f(), CL_ProcessMouseDragging(), CL_RightClickDown_f(), CL_RightClickUp_f(), CL_SelectDown_f(), uiVScrollbarNode::draw(), uiTabNode::draw(), uiSpinnerNode::draw(), uiEditorNode::drawOverWindow(), HUD_DrawMouseCursorText(), HUD_UpdateCursor(), IN_Frame(), IN_Init(), IN_JoystickMove(), uiGeoscapeNode::onCapturedMouseMove(), uiContainerNode::onDndMove(), uiEditorNode::onMouseDown(), SCR_DrawCursor(), UI_CheckMouseMove(), UI_DNDDrop(), UI_Draw(), UI_DrawCursor(), UI_DrawDragAndDrop(), UI_PushDropDownWindow_f(), and UI_VScrollbarNodeAction().
mouseSpace_t mouseSpace |
Definition at line 79 of file cl_input.cpp.
Referenced by IN_SetMouseSpace().
|
static |
Definition at line 81 of file cl_input.cpp.
Referenced by CL_GetKeyMouseState(), and IN_Frame().
|
static |
Definition at line 81 of file cl_input.cpp.
Referenced by CL_GetKeyMouseState(), and IN_Frame().
unsigned short unicode |
Definition at line 69 of file cl_input.cpp.
Referenced by IN_Frame(), IN_PrintKey(), IN_SendKeyEvents(), Key_Console(), and Key_Event().