Elevate Engine 1
Loading...
Searching...
No Matches
ApplicationEvent.h
Go to the documentation of this file.
1#pragma once
2
6#include <sstream>
7
8namespace Elevate {
9 class GameContextEvent : public Event
10 {
11 public:
12 GameContextEvent() = default;
14 : m_oldState(oldState), m_newState(newState) { }
15
16 inline GameContextState GetOldState() const { return m_oldState; }
17 inline GameContextState GetNewState() const { return m_newState; }
18
19 std::string ToString() const override
20 {
21 std::stringstream ss;
22 ss << "GameContextEvent: old:" << m_oldState << ", new:" << m_newState;
23 return ss.str();
24 }
25
28 private:
29 GameContextState m_newState;
30 GameContextState m_oldState;
31 };
32
34 {
35 public:
36 WindowResizeEvent(unsigned int width, unsigned int height)
37 : m_Width(width), m_Height(height) {}
38
39 unsigned int GetWidth() const { return m_Width; }
40 unsigned int GetHeight() const { return m_Height; }
41
42 std::string ToString() const override
43 {
44 std::stringstream ss;
45 ss << "WindowResizeEvent: " << m_Width << ", " << m_Height;
46 return ss.str();
47 }
48
49 EVENT_CLASS_TYPE(WindowResize)
50 EVENT_CLASS_CATEGORY(EventCategoryApplication)
51 private:
52 unsigned int m_Width, m_Height;
53 };
54
56 {
57 public:
58 WindowCloseEvent() = default;
59
60 EVENT_CLASS_TYPE(WindowClose)
61 EVENT_CLASS_CATEGORY(EventCategoryApplication)
62 };
63
65 {
66 public:
67 WindowFocusEvent(bool isFocused)
68 : m_IsFocused(isFocused) {
69 }
70
71 bool GetFocusState() const { return m_IsFocused; }
72
73 std::string ToString() const override
74 {
75 std::stringstream ss;
76 ss << "WindowFocusChange: " << m_IsFocused;
77 return ss.str();
78 }
79
80 EVENT_CLASS_TYPE(WindowFocus)
81 EVENT_CLASS_CATEGORY(EventCategoryApplication)
82 private:
83 bool m_IsFocused;
84 };
85
86 class EE_API AppTickEvent : public Event
87 {
88 public:
89 AppTickEvent() = default;
90
91 EVENT_CLASS_TYPE(AppTick)
92 EVENT_CLASS_CATEGORY(EventCategoryApplication)
93 };
94
96 {
97 public:
98 AppUpdateEvent() = default;
99
100 EVENT_CLASS_TYPE(AppUpdate)
101 EVENT_CLASS_CATEGORY(EventCategoryApplication)
102 };
103
105 {
106 public:
107 AppRenderEvent() = default;
108
109 EVENT_CLASS_TYPE(AppRender)
110 EVENT_CLASS_CATEGORY(EventCategoryApplication)
111 };
112}
#define EE_API
Definition Core.h:9
#define EVENT_CLASS_TYPE(type)
Definition Event.h:31
#define EVENT_CLASS_CATEGORY(category)
Definition Event.h:35
std::string ToString() const override
GameContextState GetOldState() const
GameContextState GetNewState() const
GameContextEvent(GameContextState oldState, GameContextState newState)
std::string ToString() const override
WindowFocusEvent(bool isFocused)
unsigned int GetHeight() const
WindowResizeEvent(unsigned int width, unsigned int height)
unsigned int GetWidth() const
std::string ToString() const override
@ EventCategoryGameContext
Definition Event.h:28
GameContextState
Definition GameContext.h:6