nngn
|
Dispatches keyboard input events to pre-registered Lua functions. More...
#include <input.h>
Classes | |
struct | Source |
Public Types | |
enum | Selector : std::uint8_t { PRESS = 1u << 0 , CTRL = 1u << 1 , ALT = 1u << 2 } |
Indicates that a callback should only handle a sub-set of events. More... | |
enum | Action : std::uint8_t { KEY_PRESS = 0b1 , KEY_RELEASE = 0 } |
enum | Modifier : std::uint8_t { MOD_SHIFT = 0b1 , MOD_CTRL = 0b10 , MOD_ALT = 0b100 } |
enum | { KEY_ESC = 256 , KEY_ENTER , KEY_TAB , KEY_RIGHT = 262 , KEY_LEFT , KEY_DOWN , KEY_UP , KEY_PAGE_UP = 266 , KEY_PAGE_DOWN , KEY_MAX = 348 } |
enum | TerminalFlag : std::uint8_t { OUTPUT_PROCESSING = 1u << 0 } |
Public Member Functions | |
void | init (lua_State *L_) |
void | get_keys (std::span< i32 > keys) const |
void | has_override (std::size_t n, i32 *keys) const |
BindingGroup * | binding_group () const |
void | set_binding_group (BindingGroup *g) |
void | add_source (std::unique_ptr< Source > p) |
bool | remove_source (Source *p) |
bool | override_keys (bool pressed, std::span< const i32 > keys) |
bool | register_callback () |
bool | remove_callback () |
bool | update () |
bool | key_callback (int key, Action action, Modifier mods) const |
Private Attributes | |
lua_State * | L = {} |
int | callback_ref = {} |
BindingGroup * | m_binding_group = {} |
std::bitset< KEY_MAX+1 > | overrides = {} |
std::vector< std::unique_ptr< Source > > | sources = {} |
Dispatches keyboard input events to pre-registered Lua functions.
anonymous enum |
enum nngn::Input::Selector : std::uint8_t |
void nngn::Input::add_source | ( | std::unique_ptr< Source > | p | ) |
|
inline |
void nngn::Input::get_keys | ( | std::span< i32 > | keys | ) | const |
void nngn::Input::has_override | ( | std::size_t | n, |
i32 * | keys ) const |
|
inline |
bool nngn::Input::register_callback | ( | ) |
bool nngn::Input::remove_callback | ( | ) |
|
inline |
bool nngn::Input::update | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |