SleakEngine
0.1.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
ApplicationEvent.hpp
Go to the documentation of this file.
1
#ifndef _APPLICATIONEVENT_H_
2
#define _APPLICATIONEVENT_H_
3
4
#include <
Events/Event.hpp
>
5
#include <sstream>
6
7
namespace
Sleak
{
8
namespace
Events
{
9
/// Fired when the window's client area changes size.
10
/// @ingroup events
11
class
ENGINE_API
WindowResizeEvent
:
public
Event
{
12
public
:
13
WindowResizeEvent
(uint16_t Width, uint16_t Height) : width(Width), height(Height) {}
14
15
inline
uint16_t
GetWidth
()
const
{
return
width;}
16
inline
uint16_t
GetHeight
()
const
{
return
height;}
17
18
std::string
ToString
()
const override
{
19
std::stringstream ss;
20
ss <<
"WindowResizeEvent: Width: "
<< width <<
", Height: "
<< height <<
"\n"
;
21
return
ss.str();
22
}
23
24
EVENT_CLASS_TYPE
(WindowResize)
25
EVENT_CLASS_CATEGORY
(
EventCategory
::
Application
)
26
27
private:
28
uint16_t width, height;
29
};
30
31
/// Fired once the window has been created and is ready for use.
32
/// @ingroup events
33
class ENGINE_API
WindowOpenEvent
: public
Event
{
34
public
:
35
WindowOpenEvent
() =
default
;
36
37
EVENT_CLASS_TYPE
(WindowOpen)
38
EVENT_CLASS_CATEGORY
(
EventCategory
::
Application
)
39
};
40
41
/// Fired when the window enters or leaves fullscreen mode.
42
/// @ingroup events
43
class ENGINE_API
WindowFullScreen
: public
Event
{
44
public
:
45
WindowFullScreen
(
bool
bIsFullScreen) : bIsFullScreen(bIsFullScreen) {};
46
47
EVENT_CLASS_TYPE
(WindowFullscreen)
48
EVENT_CLASS_CATEGORY
(
EventCategory
::
Application
)
49
50
inline
bool
GetFullscreen
()
const
{
return
bIsFullScreen;}
51
52
private
:
53
bool
bIsFullScreen;
54
};
55
56
/// Fired when the window is about to close.
57
/// @ingroup events
58
class
ENGINE_API
WindowCloseEvent
:
public
Event
{
59
public
:
60
WindowCloseEvent
() =
default
;
61
62
EVENT_CLASS_TYPE
(WindowClose)
63
EVENT_CLASS_CATEGORY
(
EventCategory
::
Application
)
64
};
65
66
67
/// Fired once per frame at the start of the application loop.
68
/// @ingroup events
69
class ENGINE_API
TickEvent
: public
Event
{
70
public
:
71
TickEvent
() =
default
;
72
73
EVENT_CLASS_TYPE
(Tick)
74
EVENT_CLASS_CATEGORY
(
EventCategory
::
Application
)
75
};
76
77
/// Fired once per frame during the update phase.
78
/// @ingroup events
79
class ENGINE_API
UpdateEvent
: public
Event
{
80
public
:
81
UpdateEvent
() =
default
;
82
83
EVENT_CLASS_TYPE
(Update)
84
EVENT_CLASS_CATEGORY
(
EventCategory
::
Application
)
85
};
86
87
/// Fired once per frame during the render phase.
88
/// @ingroup events
89
class ENGINE_API
RenderEvent
: public
Event
{
90
public
:
91
RenderEvent
() =
default
;
92
93
EVENT_CLASS_TYPE
(Render)
94
EVENT_CLASS_CATEGORY
(
EventCategory
::
Application
)
95
};
96
97
}
98
}
99
100
#endif
Event.hpp
EVENT_CLASS_TYPE
#define EVENT_CLASS_TYPE(type)
Definition
Event.hpp:42
EVENT_CLASS_CATEGORY
#define EVENT_CLASS_CATEGORY(category)
Definition
Event.hpp:56
Sleak::Application
Definition
Application.hpp:109
Sleak::Event::Event
Event()
Definition
Event.hpp:65
Sleak::Events::RenderEvent::RenderEvent
RenderEvent()=default
Sleak::Events::TickEvent::TickEvent
TickEvent()=default
Sleak::Events::UpdateEvent::UpdateEvent
UpdateEvent()=default
Sleak::Events::WindowCloseEvent::WindowCloseEvent
WindowCloseEvent()=default
Sleak::Events::WindowFullScreen::WindowFullScreen
WindowFullScreen(bool bIsFullScreen)
Definition
ApplicationEvent.hpp:45
Sleak::Events::WindowFullScreen::GetFullscreen
bool GetFullscreen() const
Definition
ApplicationEvent.hpp:50
Sleak::Events::WindowOpenEvent::WindowOpenEvent
WindowOpenEvent()=default
Sleak::Events::WindowResizeEvent::GetHeight
uint16_t GetHeight() const
Definition
ApplicationEvent.hpp:16
Sleak::Events::WindowResizeEvent::GetWidth
uint16_t GetWidth() const
Definition
ApplicationEvent.hpp:15
Sleak::Events::WindowResizeEvent::ToString
std::string ToString() const override
Definition
ApplicationEvent.hpp:18
Sleak::Events::WindowResizeEvent::WindowResizeEvent
WindowResizeEvent(uint16_t Width, uint16_t Height)
Definition
ApplicationEvent.hpp:13
Sleak::EventCategory
EventCategory
Definition
Event.hpp:33
Sleak::Events
Concrete event types dispatched through Sleak::EventDispatcher.
Definition
ApplicationEvent.hpp:8
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
include
public
Events
ApplicationEvent.hpp
Generated on
for SleakEngine by
1.18.0