1 #ifndef LXGUI_GUI_KEY_BINDER_HPP
2 #define LXGUI_GUI_KEY_BINDER_HPP
4 #include "lxgui/input_keys.hpp"
5 #include "lxgui/lxgui.hpp"
6 #include "lxgui/utils_signal.hpp"
8 #include <lxgui/extern_sol2_protected_function.hpp>
78 std::string_view name,
80 bool shift_is_pressed,
100 input::key key_id,
bool shift_is_pressed,
bool ctrl_is_pressed,
bool alt_is_pressed);
107 bool shift_is_pressed =
false;
108 bool ctrl_is_pressed =
false;
109 bool alt_is_pressed =
false;
114 key_binding* find_binding_(
115 input::key key_id,
bool shift_is_pressed,
bool ctrl_is_pressed,
bool alt_is_pressed);
117 std::vector<key_binding> key_bindings_;
Binds global actions to key presses.
void set_key_binding(std::string_view name, std::string_view key_name)
Binds an action to a key.
key_binder(const key_binder &)=delete
signal_type::function_type function_type
Type of a keybinding callback.
key_binder & operator=(key_binder &&)=delete
utils::connection register_key_binding(std::string_view name, sol::protected_function lua_function)
Registers an action as a possible key binding.
void remove_key_binding(std::string_view name)
Unbinds an action.
key_binder()=default
Constructor.
bool on_key_down(input::key key_id, bool shift_is_pressed, bool ctrl_is_pressed, bool alt_is_pressed)
Called when a key is pressed.
key_binder & operator=(const key_binder &)=delete
key_binder(key_binder &&)=delete
Object representing the connection between a slot and a signal.
std::function< void() > function_type
Type of the callable function stored in a slot. Can use any function/delegate type here,...