125 if (k == b->
down[0] || k == b->
down[1])
130 else if (!b->
down[1])
133 Com_Printf(
"Three keys down for a button!\n");
174 else if (b->
down[1] == k)
190 const unsigned uptime = atoi(c);
392 if ((SDL_GetMouseState(
nullptr,
nullptr) & SDL_BUTTON(SDL_BUTTON_RIGHT)) == 0)
535#define SCROLL_BORDER 4
536#define MOUSE_YAW_SCALE 0.1
537#define MOUSE_PITCH_SCALE 0.1
608 Com_Printf(
"key name: %s (down: %i)", SDL_GetKeyName(event->key.keysym.sym),
down);
609 const int unicode =
event->key.keysym.sym;
624 bool translated =
true;
669 case SDLK_PRINTSCREEN:
672 case SDLK_SCROLLLOCK:
793 case SDLK_KP_MULTIPLY:
834 if (keyNum > 0 || keyUnicode > 0) {
846 const int mask = full ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP;
847 const bool isFullScreen = SDL_GetWindowFlags(
cls.window) & mask;
848 SDL_SetWindowFullscreen(
cls.window, isFullScreen ? 0 : mask);
849 return SDL_GetWindowFlags(
cls.window) & mask;
861 int mouse_buttonstate;
878 SDL_SetWindowGrab(
cls.window, SDL_FALSE);
882 SDL_SetWindowGrab(
cls.window, SDL_TRUE);
889 while (SDL_PollEvent(&event)) {
890 switch (event.type) {
895 case SDL_TEXTEDITING:
898 case SDL_TEXTINPUT: {
899 if (!SDL_IsTextInputActive())
902 const char* text =
event.text.text;
903 const char** str = &text;
905 const int characterUnicode =
UTF8_next(str);
906 if (characterUnicode == -1) {
916 case SDL_MOUSEBUTTONDOWN:
917 case SDL_MOUSEBUTTONUP:
918 switch (event.button.button) {
919 case SDL_BUTTON_LEFT:
922 case SDL_BUTTON_MIDDLE:
925 case SDL_BUTTON_RIGHT:
935 mouse_buttonstate =
K_AUX1 + (
event.button.button - 8) % 16;
938 IN_EventEnqueue(mouse_buttonstate, 0, (event.type == SDL_MOUSEBUTTONDOWN));
941 case SDL_MOUSEMOTION:
949 if ((event.key.keysym.mod & KMOD_ALT) && event.key.keysym.sym == SDLK_RETURN) {
962 if ((event.key.keysym.mod & KMOD_CTRL) && event.key.keysym.sym == SDLK_RETURN) {
973 if ((event.key.keysym.mod & KMOD_CTRL) && event.key.keysym.sym == SDLK_g) {
974 const bool grab = SDL_GetWindowGrab(
cls.window);
981 if ((event.key.keysym.mod & KMOD_SHIFT) && event.key.keysym.sym == SDLK_ESCAPE) {
999 case SDL_WINDOWEVENT:
1000 switch (event.window.event) {
1001 case SDL_WINDOWEVENT_MOVED:
1002 viddef.context.left =
event.window.data1;
1003 viddef.context.top =
event.window.data2;
1007 case SDL_WINDOWEVENT_RESIZED:
1012 case SDL_WINDOWEVENT_FOCUS_LOST:
1043typedef struct cursorChange_s {
1069 Com_Printf(
"\n------- input initialization -------\n");
1072 in_debug =
Cvar_Get(
"in_debug",
"0", 0,
"Show input key codes on game console");
void CL_ActorSelectMouse(void)
Selects an actor using the mouse.
void CL_ActorTurnMouse(void)
Turns the actor around without moving.
void CL_BattlescapeMouseDragging(void)
Scroll battlescape touchscreen-style, by clicking and dragging away.
bool CL_ActorMouseTrace(void)
Battlescape cursor positioning.
void CL_InitBattlescapeMouseDragging(void)
Scroll battlescape touchscreen-style, by clicking and dragging away.
void CL_ActorActionMouse(void)
initiates action with mouse.
bool CL_OnBattlescape(void)
Check whether we are in a tactical mission as server or as client. But this only means that we are ab...
bool CL_BattlescapeRunning(void)
Check whether we already have actors spawned on the battlefield.
void CL_CameraZoomIn(void)
Zooms the scene of the battlefield in.
void CL_CameraZoomOut(void)
Zooms the scene of the battlefield out.
void Con_ToggleConsole_f(void)
void IN_StartupJoystick(void)
Init available joysticks.
void IN_JoystickMove(void)
static bool keyDown[K_KEY_SIZE]
const char * Key_KeynumToString(int keynum)
Convert a given keynum to string.
void Key_Event(unsigned int key, unsigned short unicode, bool down, unsigned time)
Called by the system between frames for both key up and key down events.
int Key_StringToKeynum(const char *str)
Convert to given string to keynum.
Header file for keyboard handler.
int CL_Milliseconds(void)
void SCR_ChangeCursor(int cursor)
Header for certain screen operations.
Primary header for client.
void Cmd_ExecuteString(const char *text,...)
A complete command line has been parsed, so try to execute it.
const char * Cmd_Argv(int arg)
Returns a given argument.
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
void Com_Printf(const char *const fmt,...)
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
float Cvar_GetValue(const char *varName)
Returns the float value of a cvar.
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
uiNode_t * UI_PushWindow(const char *name, const char *parentName, linkedList_t *params)
Push a window onto the window stack.
void UI_CloseWindow(const char *name)
bool UI_IsMouseOnWindow(void)
Check if a point is over a window from the stack.
int UTF8_next(const char **str)
Get the next utf-8 character from the given string.
int UTF8_encoded_len(int c)