Photon Editor Library
2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Event.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <Common/primitive_type.h>
4
#include <Common/assertion.h>
5
#include <Math/math.h>
6
#include <Utility/utility.h>
7
8
#include <string>
9
10
namespace
ph::editor
11
{
12
13
enum class
EEventType
14
{
15
Unknown
= 0,
16
17
// TODO: distanguish between main window and window (child/internal)?
18
19
DisplayClose
,
20
DisplayResize
,
21
DisplayFocus
,
22
DisplayLostFocus
,
23
DisplayMove
,
24
25
FramebufferResize
,
26
27
AppTick
,
28
AppUpdate
,
29
AppRender
,
30
31
KeyDown
,
32
KeyUp
,
33
KeyHit
,
34
35
MouseButtonDown
,
36
MouseButtonUp
,
37
MouseClick
,
38
MouseScroll
,
39
MouseMove
,
40
};
41
42
enum class
EEventSource
: uint32f
43
{
44
Unknown
= 0,
45
46
App
= math::flag_bit<uint32f, 0>(),
47
Input
= math::flag_bit<uint32f, 1>(),
48
Keyboard
= math::flag_bit<uint32f, 2>(),
49
Mouse
= math::flag_bit<uint32f, 3>(),
50
MouseButton
= math::flag_bit<uint32f, 4>(),
51
};
52
58
class
Event
59
{
60
// Hide special members as this class is not intended to be used polymorphically.
61
// It is derived class's choice to expose them (by defining them in public) or not.
62
protected
:
63
PH_DEFINE_INLINE_RULE_OF_5_MEMBERS
(
Event
);
64
65
public
:
66
/*inline Event() = default;
67
inline virtual ~Event() = default;*/
68
69
/*virtual EEventType getDynamicType() const = 0;
70
virtual EEventSource getSourceType() const = 0;
71
virtual std::string toString() const = 0;*/
72
73
void
consume
();
74
bool
isConsumed
()
const
;
75
//bool isFromSource(EEventSource fromSourceType) const;
76
77
private
:
78
uint8 m_isConsumed : 1 =
false
;
79
};
80
81
inline
void
Event::consume
()
82
{
83
PH_ASSERT_MSG(!m_isConsumed,
"Consuming already-consumed editor event."
);
84
85
m_isConsumed =
true
;
86
}
87
88
inline
bool
Event::isConsumed
()
const
89
{
90
return
m_isConsumed;
91
}
92
93
}
// end namespace ph::editor
ph::editor::Event
Base of all event types. Derived classes should strive to keep the size of the object small,...
Definition
Event.h:59
ph::editor::Event::consume
void consume()
Definition
Event.h:81
ph::editor::Event::isConsumed
bool isConsumed() const
Definition
Event.h:88
ph::editor::Event::PH_DEFINE_INLINE_RULE_OF_5_MEMBERS
PH_DEFINE_INLINE_RULE_OF_5_MEMBERS(Event)
ph::editor
Definition
ph_editor.h:10
ph::editor::EKeyCode::Unknown
@ Unknown
ph::editor::EEventSource
EEventSource
Definition
Event.h:43
ph::editor::EEventSource::Input
@ Input
ph::editor::EEventSource::MouseButton
@ MouseButton
ph::editor::EEventSource::Keyboard
@ Keyboard
ph::editor::EEventSource::App
@ App
ph::editor::EEventSource::Mouse
@ Mouse
ph::editor::EEventType
EEventType
Definition
Event.h:14
ph::editor::EEventType::KeyUp
@ KeyUp
ph::editor::EEventType::MouseClick
@ MouseClick
ph::editor::EEventType::MouseButtonUp
@ MouseButtonUp
ph::editor::EEventType::FramebufferResize
@ FramebufferResize
ph::editor::EEventType::DisplayResize
@ DisplayResize
ph::editor::EEventType::AppRender
@ AppRender
ph::editor::EEventType::AppTick
@ AppTick
ph::editor::EEventType::DisplayFocus
@ DisplayFocus
ph::editor::EEventType::DisplayLostFocus
@ DisplayLostFocus
ph::editor::EEventType::MouseButtonDown
@ MouseButtonDown
ph::editor::EEventType::KeyHit
@ KeyHit
ph::editor::EEventType::MouseScroll
@ MouseScroll
ph::editor::EEventType::DisplayMove
@ DisplayMove
ph::editor::EEventType::AppUpdate
@ AppUpdate
ph::editor::EEventType::KeyDown
@ KeyDown
ph::editor::EEventType::DisplayClose
@ DisplayClose
ph::editor::EEventType::MouseMove
@ MouseMove
Source
EditorCore
Event
Event.h
Generated by
1.11.0