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 , PRESS = 1 , RELEASE = 0 }
 
enum class  Action : std::uint8_t { PRESS = 1 , RELEASE = 0 , 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.
 
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 [1/2]

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

◆ Action [2/2]

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

Member Function Documentation

◆ button_callback() [1/2]

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:

◆ button_callback() [2/2]

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

Triggers a button event.

◆ init() [1/2]

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

◆ init() [2/2]

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

◆ move_callback() [1/2]

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

Triggers a move event.

Here is the call graph for this function:

◆ move_callback() [2/2]

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

Triggers a move event.

◆ register_button_callback() [1/2]

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_button_callback() [2/2]

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.

◆ register_move_callback() [1/2]

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:

◆ register_move_callback() [2/2]

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.

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: