UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_input.h
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23*/
24
25#pragma once
26
27/* prototype */
28struct uiNode_t;
29
30#define UI_MAX_KEYBINDING 128
31
32typedef struct uiKeyBinding_s {
34 const struct value_s* property;
35 int key;
36 const char* description;
37 bool inherited;
38 struct uiKeyBinding_s* next;
40
41void UI_SetKeyBinding(const char* path, int key, const char* description);
42
43/* mouse input */
44void UI_MouseScroll(int deltaX, int deltaY);
45void UI_MouseMove(int x, int y);
46void UI_MouseDown(int x, int y, int button);
47void UI_MouseUp(int x, int y, int button);
48void UI_InvalidateMouse(void);
49bool UI_CheckMouseMove(void);
51void UI_ResetInput(void);
52
53/* focus */
54void UI_RequestFocus(uiNode_t* node);
55bool UI_HasFocus(uiNode_t const* node);
56void UI_RemoveFocus(void);
57bool UI_KeyRelease(unsigned int key, unsigned short unicode);
58bool UI_KeyPressed(unsigned int key, unsigned short unicode);
59int UI_GetKeyBindingCount(void);
61
62/* mouse capture */
65void UI_MouseRelease(void);
66
67/* all inputs */
68void UI_ReleaseInput(void);
unsigned int key
Definition cl_input.cpp:64
unsigned short unicode
Definition cl_input.cpp:65
QGL_EXTERN GLuint index
Definition r_gl.h:110
struct uiKeyBinding_s * next
Definition ui_input.h:38
uiNode_t * node
Definition ui_input.h:33
const char * description
Definition ui_input.h:36
const struct value_s * property
Definition ui_input.h:34
Atomic structure used to define most of the UI.
Definition ui_nodes.h:80
bool UI_CheckMouseMove(void)
Call mouse move only if the mouse position change.
Definition ui_input.cpp:569
void UI_SetMouseCapture(uiNode_t *node)
Captured the mouse into a node.
Definition ui_input.cpp:516
void UI_RequestFocus(uiNode_t *node)
request the focus for a node
Definition ui_input.cpp:206
uiNode_t * UI_GetHoveredNode(void)
Get the current hovered node.
Definition ui_input.cpp:552
void UI_MouseUp(int x, int y, int button)
Called when we are in UI mode and up a mouse button.
Definition ui_input.cpp:839
void UI_MouseScroll(int deltaX, int deltaY)
Called when we are in UI mode and scroll via mousewheel.
Definition ui_input.cpp:756
bool UI_HasFocus(uiNode_t const *node)
check if a node got the focus
Definition ui_input.cpp:230
void UI_SetKeyBinding(const char *path, int key, const char *description)
Set a binding from a key to a node to active.
Definition ui_input.cpp:362
void UI_RemoveFocus(void)
Definition ui_input.cpp:241
void UI_ReleaseInput(void)
Release all captured input (keyboard or mouse).
Definition ui_input.cpp:496
uiNode_t * UI_GetMouseCapture(void)
Return the captured node.
Definition ui_input.cpp:508
uiKeyBinding_t * UI_GetKeyBindingByIndex(int index)
Definition ui_input.cpp:277
void UI_ResetInput(void)
Definition ui_input.cpp:538
void UI_MouseDown(int x, int y, int button)
Called when we are in UI mode and down a mouse button.
Definition ui_input.cpp:801
void UI_InvalidateMouse(void)
Force to invalidate the mouse position and then to update hover nodes...
Definition ui_input.cpp:560
void UI_MouseMove(int x, int y)
Is called every time the mouse position change.
Definition ui_input.cpp:588
bool UI_KeyPressed(unsigned int key, unsigned short unicode)
Called by the client when the user type a key.
Definition ui_input.cpp:430
int UI_GetKeyBindingCount(void)
Definition ui_input.cpp:272
bool UI_KeyRelease(unsigned int key, unsigned short unicode)
Called by the client when the user released a key.
Definition ui_input.cpp:413
void UI_MouseRelease(void)
Release the captured node.
Definition ui_input.cpp:526