SleakEngine 1.0.0
C++23 multi-backend game engine
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
7namespace 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)
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)
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)
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)
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
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
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
95 };
96
97 }
98}
99
100#endif
#define EVENT_CLASS_TYPE(type)
Definition Event.hpp:42
#define EVENT_CLASS_CATEGORY(category)
Definition Event.hpp:56
std::string ToString() const override
WindowResizeEvent(uint16_t Width, uint16_t Height)
EventCategory
Definition Event.hpp:33
Concrete event types dispatched through Sleak::EventDispatcher.
Root namespace for everything the engine exposes.
Definition Camera.hpp:10