nngn
Loading...
Searching...
No Matches
nngn::MouseInput Class Reference

Mouse event manager. More...

#include <mouse.h>

Public Types

enum class  Action : std::uint8_t { PRESS = 1 , RELEASE = 0 }
 

Public Member Functions

void init (lua_State *L_)
 
void register_button_callback ()
 Registers a Lua function called when a button is pressed.
 
void register_move_callback ()
 Registers a Lua function called when the mouse position changes.
 
bool button_callback (int button, int action, int mods)
 Triggers a button event.
 
bool move_callback (dvec2 pos)
 Triggers a move event.
 

Private Attributes

lua_State * L = {}
 
int button_cb = {}
 
int move_cb = {}
 

Detailed Description

Mouse event manager.

Registered Lua callback functions are later called when events happen. Events are manually triggered using the *_callback(...) functions.

Member Enumeration Documentation

◆ Action

enum class nngn::MouseInput::Action : std::uint8_t
strong
Enumerator
PRESS 
RELEASE 

Member Function Documentation

◆ button_callback()

bool nngn::MouseInput::button_callback ( int button,
int action,
int mods )

Triggers a button event.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void nngn::MouseInput::init ( lua_State * L_)
inline

◆ move_callback()

bool nngn::MouseInput::move_callback ( dvec2 pos)

Triggers a move event.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_button_callback()

void nngn::MouseInput::register_button_callback ( )

Registers a Lua function called when a button is pressed.

The Lua stack is expected to contain the function object at the top.

Here is the caller graph for this function:

◆ register_move_callback()

void nngn::MouseInput::register_move_callback ( )

Registers a Lua function called when the mouse position changes.

The Lua stack is expected to contain the function object at the top.

Here is the caller graph for this function:

Member Data Documentation

◆ button_cb

int nngn::MouseInput::button_cb = {}
private

◆ L

lua_State* nngn::MouseInput::L = {}
private

◆ move_cb

int nngn::MouseInput::move_cb = {}
private

The documentation for this class was generated from the following files: