nngn
Loading...
Searching...
No Matches
mouse.h
Go to the documentation of this file.
1
#ifndef NNGN_INPUT_MOUSE_H
2
#define NNGN_INPUT_MOUSE_H
3
4
#include "
math/vec2.h
"
5
6
struct
lua_State;
7
8
namespace
nngn
{
9
15
class
MouseInput
{
16
public
:
17
enum class
Action
: std::uint8_t {
PRESS
= 1,
RELEASE
= 0 };
18
void
init
(lua_State *L_) { this->
L
= L_; }
23
void
register_button_callback
();
28
void
register_move_callback
();
30
bool
button_callback
(
int
button,
int
action,
int
mods);
32
bool
move_callback
(
dvec2
pos
);
33
private
:
34
lua_State *
L
= {};
35
int
button_cb
= {},
move_cb
= {};
36
};
37
38
}
39
40
#endif
nngn::MouseInput
Mouse event manager.
Definition
mouse.h:15
nngn::MouseInput::button_callback
bool button_callback(int button, int action, int mods)
Triggers a button event.
Definition
mouse.cpp:27
nngn::MouseInput::move_callback
bool move_callback(dvec2 pos)
Triggers a move event.
Definition
mouse.cpp:43
nngn::MouseInput::move_cb
int move_cb
Definition
mouse.h:35
nngn::MouseInput::Action
Action
Definition
mouse.h:17
nngn::MouseInput::Action::RELEASE
@ RELEASE
nngn::MouseInput::Action::PRESS
@ PRESS
nngn::MouseInput::button_cb
int button_cb
Definition
mouse.h:35
nngn::MouseInput::L
lua_State * L
Definition
mouse.h:34
nngn::MouseInput::register_move_callback
void register_move_callback()
Registers a Lua function called when the mouse position changes.
Definition
mouse.cpp:24
nngn::MouseInput::init
void init(lua_State *L_)
Definition
mouse.h:18
nngn::MouseInput::register_button_callback
void register_button_callback()
Registers a Lua function called when a button is pressed.
Definition
mouse.cpp:22
pos
pos
Definition
lua_audio.cpp:17
nngn
Definition
audio.cpp:7
nngn::vec2_base
Definition
vec2.h:11
vec2.h
src
input
mouse.h
Generated by
1.11.0