le2d
v0.4.6
2D game engine framework
Loading...
Searching...
No Matches
event.hpp
Go to the documentation of this file.
1
#pragma once
2
#include "
le2d/vector_space.hpp
"
3
#include <glm/vec2.hpp>
4
#include <klib/visitor.hpp>
5
#include <kvf/codepoint.hpp>
6
#include <span>
7
#include <string>
8
#include <variant>
9
10
namespace
le
{
11
namespace
event {
12
struct
WindowClose
{};
13
14
enum class
WindowFocus
:
bool
{
False
,
True
};
15
16
enum class
CursorFocus
:
bool
{
False
,
True
};
17
18
enum class
WindowIconify
:
bool
{
False
,
True
};
19
20
struct
FramebufferResize
: glm::ivec2 {
21
using
glm::ivec2::ivec2;
22
};
23
24
struct
WindowResize
: glm::ivec2 {
25
using
glm::ivec2::ivec2;
26
};
27
28
struct
WindowPos
:
window::ivec2
{
29
using
window::ivec2::ivec2;
30
};
31
32
struct
CursorPos
{
33
window::vec2
window
{};
34
ndc::vec2
normalized
{};
35
};
36
37
using
Codepoint
= kvf::Codepoint;
38
39
struct
Key
{
40
int
key
;
41
int
action
;
42
int
mods
;
43
44
auto
operator==
(
Key
const
&)
const
->
bool
=
default
;
45
};
46
47
struct
MouseButton
{
48
int
button
;
49
int
action
;
50
int
mods
;
51
52
auto
operator==
(
MouseButton
const
&)
const
->
bool
=
default
;
53
};
54
55
struct
Scroll
: glm::vec2 {
56
using
glm::vec2::vec2;
57
};
58
59
struct
Drop
{
60
std::span<std::string const>
paths
{};
61
};
62
63
using
Event
= std::variant<
WindowClose
,
WindowFocus
,
CursorFocus
,
FramebufferResize
,
WindowResize
,
WindowPos
,
WindowIconify
,
CursorPos
,
Codepoint
,
Key
,
64
MouseButton
,
Scroll
,
Drop
>;
65
}
// namespace event
66
67
using
Event
=
event::Event
;
68
}
// namespace le
le::event::Codepoint
kvf::Codepoint Codepoint
Definition
event.hpp:37
le::event::CursorFocus
CursorFocus
Definition
event.hpp:16
le::event::WindowIconify
WindowIconify
Definition
event.hpp:18
le::event::Event
std::variant< WindowClose, WindowFocus, CursorFocus, FramebufferResize, WindowResize, WindowPos, WindowIconify, CursorPos, Codepoint, Key, MouseButton, Scroll, Drop > Event
Definition
event.hpp:64
le::event::WindowFocus
WindowFocus
Definition
event.hpp:14
le::event::WindowFocus::True
@ True
le::event::WindowFocus::False
@ False
le
Definition
animation.hpp:8
le::Event
event::Event Event
Definition
event.hpp:67
le::event::CursorPos
Definition
event.hpp:32
le::event::CursorPos::window
window::vec2 window
Definition
event.hpp:33
le::event::CursorPos::normalized
ndc::vec2 normalized
Definition
event.hpp:34
le::event::Drop
Definition
event.hpp:59
le::event::Drop::paths
std::span< std::string const > paths
Definition
event.hpp:60
le::event::FramebufferResize
Definition
event.hpp:20
le::event::Key
Definition
event.hpp:39
le::event::Key::operator==
auto operator==(Key const &) const -> bool=default
le::event::Key::action
int action
Definition
event.hpp:41
le::event::Key::key
int key
Definition
event.hpp:40
le::event::Key::mods
int mods
Definition
event.hpp:42
le::event::MouseButton
Definition
event.hpp:47
le::event::MouseButton::operator==
auto operator==(MouseButton const &) const -> bool=default
le::event::MouseButton::button
int button
Definition
event.hpp:48
le::event::MouseButton::action
int action
Definition
event.hpp:49
le::event::MouseButton::mods
int mods
Definition
event.hpp:50
le::event::Scroll
Definition
event.hpp:55
le::event::WindowClose
Definition
event.hpp:12
le::event::WindowPos
Definition
event.hpp:28
le::event::WindowResize
Definition
event.hpp:24
le::ndc::vec2
Definition
vector_space.hpp:11
le::window::tvec2
Definition
vector_space.hpp:35
vector_space.hpp
lib
include
le2d
event.hpp
Generated by
1.9.8