lxgui
Loading...
Searching...
No Matches
Namespaces | Classes | Enumerations | Functions | Variables
lxgui::input Namespace Reference

Namespaces

namespace  sdl
 
namespace  sfml
 

Classes

class  dispatcher
 Handles inputs (keyboard and mouse) More...
 
struct  key_pressed_data
 Data for on_key_pressed signal. More...
 
struct  key_pressed_repeat_data
 Data for on_key_pressed_repeat signal. More...
 
struct  key_released_data
 Data for on_key_released signal. More...
 
struct  mouse_double_clicked_data
 Data for on_mouse_double_clicked signal. More...
 
struct  mouse_drag_start_data
 Data for on_mouse_drag_start signal. More...
 
struct  mouse_drag_stop_data
 Data for on_mouse_drag_stop signal. More...
 
struct  mouse_moved_data
 Data for on_mouse_moved signal. More...
 
struct  mouse_pressed_data
 Data for on_mouse_pressed signal. More...
 
struct  mouse_released_data
 Data for on_mouse_released signal. More...
 
struct  mouse_wheel_data
 Data for on_mouse_wheel signal. More...
 
class  signals
 Stores signals for input events. More...
 
class  source
 The base class for input source implementation. More...
 
struct  text_entered_data
 Data for on_text_entered signal. More...
 
class  window
 Represents the window in which the UI is displayed. More...
 
class  world_dispatcher
 Generates input events for the world, after filtering by the UI. More...
 

Enumerations

enum class  mouse_button : std::uint8_t { left = 0 , right , middle }
 
enum class  mouse_button_event : std::uint8_t { up = 0 , down = 1 , double_click = 2 }
 
enum class  key : std::uint8_t {
  k_unassigned = 0x00 , k_escape = 0x01 , k_1 = 0x02 , k_2 = 0x03 ,
  k_3 = 0x04 , k_4 = 0x05 , k_5 = 0x06 , k_6 = 0x07 ,
  k_7 = 0x08 , k_8 = 0x09 , k_9 = 0x0A , k_0 = 0x0B ,
  k_minus = 0x0C , k_equals = 0x0D , k_back = 0x0E , k_tab = 0x0F ,
  k_q = 0x10 , k_w = 0x11 , k_e = 0x12 , k_r = 0x13 ,
  k_t = 0x14 , k_y = 0x15 , k_u = 0x16 , k_i = 0x17 ,
  k_o = 0x18 , k_p = 0x19 , k_lbracket = 0x1A , k_rbracket = 0x1B ,
  k_return = 0x1C , k_lcontrol = 0x1D , k_a = 0x1E , k_s = 0x1F ,
  k_d = 0x20 , k_f = 0x21 , k_g = 0x22 , k_h = 0x23 ,
  k_j = 0x24 , k_k = 0x25 , k_l = 0x26 , k_semicolon = 0x27 ,
  k_apostrophe = 0x28 , k_grave = 0x29 , k_lshift = 0x2A , k_backslash = 0x2B ,
  k_z = 0x2C , k_x = 0x2D , k_c = 0x2E , k_v = 0x2F ,
  k_b = 0x30 , k_n = 0x31 , k_m = 0x32 , k_comma = 0x33 ,
  k_period = 0x34 , k_slash = 0x35 , k_rshift = 0x36 , k_multiply = 0x37 ,
  k_lmenu = 0x38 , k_space = 0x39 , k_capital = 0x3A , k_f1 = 0x3B ,
  k_f2 = 0x3C , k_f3 = 0x3D , k_f4 = 0x3E , k_f5 = 0x3F ,
  k_f6 = 0x40 , k_f7 = 0x41 , k_f8 = 0x42 , k_f9 = 0x43 ,
  k_f10 = 0x44 , k_numlock = 0x45 , k_scroll = 0x46 , k_numpad_7 = 0x47 ,
  k_numpad_8 = 0x48 , k_numpad_9 = 0x49 , k_subtract = 0x4A , k_numpad_4 = 0x4B ,
  k_numpad_5 = 0x4C , k_numpad_6 = 0x4D , k_add = 0x4E , k_numpad_1 = 0x4F ,
  k_numpad_2 = 0x50 , k_numpad_3 = 0x51 , k_numpad_0 = 0x52 , k_decimal = 0x53 ,
  k_oem_102 = 0x56 , k_f11 = 0x57 , k_f12 = 0x58 , k_f13 = 0x64 ,
  k_f14 = 0x65 , k_f15 = 0x66 , k_kana = 0x70 , k_abnt_c1 = 0x73 ,
  k_convert = 0x79 , k_noconvert = 0x7B , k_yen = 0x7D , k_abnt_c2 = 0x7E ,
  k_numpadequals = 0x8D , k_prevtrack = 0x90 , k_at = 0x91 , k_colon = 0x92 ,
  k_underline = 0x93 , k_kanji = 0x94 , k_stop = 0x95 , k_ax = 0x96 ,
  k_unlabeled = 0x97 , k_nexttrack = 0x99 , k_numpadenter = 0x9C , k_rcontrol = 0x9D ,
  k_mute = 0xA0 , k_calculator = 0xA1 , k_playpause = 0xA2 , k_mediastop = 0xA4 ,
  k_volumedown = 0xAE , k_volumeup = 0xB0 , k_webhome = 0xB2 , k_numpadcomma = 0xB3 ,
  k_divide = 0xB5 , k_sysrq = 0xB7 , k_rmenu = 0xB8 , k_pause = 0xC5 ,
  k_home = 0xC7 , k_up = 0xC8 , k_pgup = 0xC9 , k_left = 0xCB ,
  k_right = 0xCD , k_end = 0xCF , k_down = 0xD0 , k_pgdown = 0xD1 ,
  k_insert = 0xD2 , k_delete = 0xD3 , k_lwin = 0xDB , k_rwin = 0xDC ,
  k_apps = 0xDD , k_power = 0xDE , k_sleep = 0xDF , k_wake = 0xE3 ,
  k_websearch = 0xE5 , k_webfavorites = 0xE6 , k_webrefresh = 0xE7 , k_webstop = 0xE8 ,
  k_webforward = 0xE9 , k_webback = 0xEA , k_mycomputer = 0xEB , k_mail = 0xEC ,
  k_mediaselect = 0xED , k_maxkey = 0xFF
}
 

Functions

std::string_view get_mouse_button_codename (mouse_button button_id)
 Returns a standard English name for the provided mouse button.
 
std::string_view get_localizable_mouse_button_name (mouse_button button_id)
 Returns the localizable name of the provided mouse button.
 
std::string_view get_mouse_button_event_codename (mouse_button_event button_event)
 Returns a standard English name for the provided mouse button event.
 
std::string_view get_localizable_mouse_button_event_name (mouse_button_event button_event)
 Returns the localizable name of the provided mouse button event.
 
std::string_view get_mouse_button_and_event_codename (mouse_button button_id, mouse_button_event button_event)
 Returns a standard Engilsh name for the provided mouse button and event.
 
std::optional< std::pair< mouse_button, mouse_button_event > > get_mouse_button_and_event_from_codename (std::string_view button_and_event_name)
 Returns a mouse button and a button event ID from a string formatted as "<button>:<event>".
 
std::string_view get_key_codename (key key_id)
 Returns a standard English name for the provided key.
 
key get_key_from_codename (std::string_view key_name)
 Returns the key code from the standard English name of a key.
 
std::string_view get_localizable_key_name (key key_id)
 Returns the localizable name of the provided key.
 

Variables

constexpr std::size_t mouse_button_number = 3u
 
constexpr std::size_t key_number = static_cast<std::size_t>(key::k_maxkey)
 

Enumeration Type Documentation

◆ key

enum class lxgui::input::key : std::uint8_t
strong
Enumerator
k_unassigned 
k_escape 
k_1 
k_2 
k_3 
k_4 
k_5 
k_6 
k_7 
k_8 
k_9 
k_0 
k_minus 
k_equals 
  • on main keyboard
k_back 
k_tab 

Backspace.

k_q 
k_w 
k_e 
k_r 
k_t 
k_y 
k_u 
k_i 
k_o 
k_p 
k_lbracket 
k_rbracket 
k_return 
k_lcontrol 

Enter on main keyboard.

k_a 
k_s 
k_d 
k_f 
k_g 
k_h 
k_j 
k_k 
k_l 
k_semicolon 
k_apostrophe 
k_grave 
k_lshift 

Accent.

k_backslash 
k_z 
k_x 
k_c 
k_v 
k_b 
k_n 
k_m 
k_comma 
k_period 
k_slash 

. on main keyboard

k_rshift 

/ on main keyboard

k_multiply 
k_lmenu 
  • on numeric keypad
k_space 

Left Alt.

k_capital 
k_f1 
k_f2 
k_f3 
k_f4 
k_f5 
k_f6 
k_f7 
k_f8 
k_f9 
k_f10 
k_numlock 
k_scroll 
k_numpad_7 

Scroll Lock.

k_numpad_8 
k_numpad_9 
k_subtract 
k_numpad_4 
  • on numeric keypad
k_numpad_5 
k_numpad_6 
k_add 
k_numpad_1 
  • on numeric keypad
k_numpad_2 
k_numpad_3 
k_numpad_0 
k_decimal 
k_oem_102 

. on numeric keypad

k_f11 

< > | on UK/Germany keyboards

k_f12 
k_f13 
k_f14 

(NEC PC98)

k_f15 

(NEC PC98)

k_kana 

(NEC PC98)

k_abnt_c1 

(Japanese keyboard)

k_convert 

/ ? on Portugese (Brazilian) keyboards

k_noconvert 

(Japanese keyboard)

k_yen 

(Japanese keyboard)

k_abnt_c2 

(Japanese keyboard)

k_numpadequals 

Numpad . on Portugese (Brazilian) keyboards.

k_prevtrack 

= on numeric keypad (NEC PC98)

k_at 

Previous Track (K_CIRCUMFLEX on Japanese keyboard)

k_colon 

(NEC PC98)

k_underline 

(NEC PC98)

k_kanji 

(NEC PC98)

k_stop 

(Japanese keyboard)

k_ax 

(NEC PC98)

k_unlabeled 

(Japan AX)

k_nexttrack 

(J3100)

k_numpadenter 

Next Track.

k_rcontrol 

Enter on numeric keypad.

k_mute 
k_calculator 

Mute.

k_playpause 

Calculator.

k_mediastop 

Play / Pause.

k_volumedown 

Media Stop.

k_volumeup 

Volume -.

k_webhome 

Volume +.

k_numpadcomma 

Web home.

k_divide 

, on numeric keypad (NEC PC98)

k_sysrq 

/ on numeric keypad

k_rmenu 
k_pause 

Right Alt.

k_home 

Pause.

k_up 

Home on arrow keypad.

k_pgup 

UpArrow on arrow keypad.

k_left 

PgUp on arrow keypad.

k_right 

LeftArrow on arrow keypad.

k_end 

RightArrow on arrow keypad.

k_down 

End on arrow keypad.

k_pgdown 

DownArrow on arrow keypad.

k_insert 

PgDn on arrow keypad.

k_delete 

Insert on arrow keypad.

k_lwin 

Delete on arrow keypad.

k_rwin 

Left Windows key.

k_apps 

Right Windows key.

k_power 

AppMenu key.

k_sleep 

System Power.

k_wake 

System Sleep.

k_websearch 

System Wake.

k_webfavorites 

Web Search.

k_webrefresh 

Web Favorites.

k_webstop 

Web Refresh.

k_webforward 

Web Stop.

k_webback 

Web Forward.

k_mycomputer 

Web Back.

k_mail 

My Computer.

k_mediaselect 

Mail.

k_maxkey 

Media Select.

Definition at line 16 of file input_keys.hpp.

◆ mouse_button

enum class lxgui::input::mouse_button : std::uint8_t
strong
Enumerator
left 
right 
middle 

Definition at line 12 of file input_keys.hpp.

◆ mouse_button_event

enum class lxgui::input::mouse_button_event : std::uint8_t
strong
Enumerator
up 
down 
double_click 

Definition at line 14 of file input_keys.hpp.

Function Documentation

◆ get_key_codename()

std::string_view lxgui::input::get_key_codename ( key  key_id)

Returns a standard English name for the provided key.

Parameters
key_idThe key
Returns
The name of the provided key
Note
This will return a standard English key name, e.g., "Enter" for the Enter key. This can be used for string-based key identification in scripts, where key integer codes would be less usable, or for displaying debug or error messages.

Definition at line 105 of file input_keys.cpp.

◆ get_key_from_codename()

key lxgui::input::get_key_from_codename ( std::string_view  key_name)

Returns the key code from the standard English name of a key.

Parameters
key_nameThe name of the key
Returns
The key code
Note
The name of the key must be from get_key_codename().

Definition at line 240 of file input_keys.cpp.

◆ get_localizable_key_name()

std::string_view lxgui::input::get_localizable_key_name ( key  key_id)

Returns the localizable name of the provided key.

Parameters
key_idThe key
Returns
The localizable name of the provided key
Note
This will return localizable key names, e.g., "{key_enter}" for the Enter key. Use a lxgui::gui::localizer to transform this into a user-friendly name.

Definition at line 251 of file input_keys.cpp.

◆ get_localizable_mouse_button_event_name()

std::string_view lxgui::input::get_localizable_mouse_button_event_name ( mouse_button_event  button_event)

Returns the localizable name of the provided mouse button event.

Parameters
button_eventThe ID code of the mouse button event
Returns
The localizable name of the provided mouse button event
Note
This will return localizable button names, e.g., "{mouse_event_up}" for the mouse up event. Use a lxgui::gui::localizer to transform this into a user-friendly name.

Definition at line 34 of file input_keys.cpp.

◆ get_localizable_mouse_button_name()

std::string_view lxgui::input::get_localizable_mouse_button_name ( mouse_button  button_id)

Returns the localizable name of the provided mouse button.

Parameters
button_idThe ID code of the mouse button
Returns
The localizable name of the provided mouse button
Note
This will return localizable button names, e.g., "{mouse_left}" for the left mouse button. Use a lxgui::gui::localizer to transform this into a user-friendly name.

Definition at line 16 of file input_keys.cpp.

◆ get_mouse_button_and_event_codename()

std::string_view lxgui::input::get_mouse_button_and_event_codename ( mouse_button  button_id,
mouse_button_event  button_event 
)

Returns a standard Engilsh name for the provided mouse button and event.

Parameters
button_idThe ID code of the mouse button
button_eventThe ID code of the mouse button event
Returns
The corresponding code name in English
Note
This will return a string with the format "<button>:<event>".
See also
get_mouse_button_codename()
get_mouse_button_event_codename()

Definition at line 44 of file input_keys.cpp.

◆ get_mouse_button_and_event_from_codename()

std::optional< std::pair< mouse_button, mouse_button_event > > lxgui::input::get_mouse_button_and_event_from_codename ( std::string_view  button_and_event_name)

Returns a mouse button and a button event ID from a string formatted as "<button>:<event>".

Parameters
event_nameThe name of the mouse button event, as "<button>:<event>"
Returns
The pair of decoded button and event ID, or std::nullopt if parsing failed.

Definition at line 72 of file input_keys.cpp.

◆ get_mouse_button_codename()

std::string_view lxgui::input::get_mouse_button_codename ( mouse_button  button_id)

Returns a standard English name for the provided mouse button.

Parameters
button_idThe ID code of the mouse button
Returns
The corresponding code name in English
Note
This will return a standard English button name, e.g., "LeftButton" for the left mouse button. This can be used for string-based key identification in scripts, where key integer codes would be less usable, or for displaying debug or error messages.

Definition at line 7 of file input_keys.cpp.

◆ get_mouse_button_event_codename()

std::string_view lxgui::input::get_mouse_button_event_codename ( mouse_button_event  button_event)

Returns a standard English name for the provided mouse button event.

Parameters
button_eventThe ID code of the mouse button event
Returns
The corresponding code name in English
Note
This will return a standard English button name, e.g., "Up" for the mouse up event. This can be used for string-based key identification in scripts, where key integer codes would be less usable, or for displaying debug or error messages.

Definition at line 25 of file input_keys.cpp.

Variable Documentation

◆ key_number

constexpr std::size_t lxgui::input::key_number = static_cast<std::size_t>(key::k_maxkey)
constexpr

Definition at line 251 of file input_keys.hpp.

◆ mouse_button_number

constexpr std::size_t lxgui::input::mouse_button_number = 3u
constexpr

Definition at line 250 of file input_keys.hpp.