Elevate Engine
1
Loading...
Searching...
No Matches
ApplicationEvent.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
ElevateEngine/Events/Event.h
>
4
#include <
ElevateEngine/Core/Log.h
>
5
#include <
ElevateEngine/Core/GameContext.h
>
6
#include <sstream>
7
8
namespace
Elevate
{
9
class
GameContextEvent
:
public
Event
10
{
11
public
:
12
GameContextEvent
() =
default
;
13
GameContextEvent
(
GameContextState
oldState,
GameContextState
newState)
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
26
EVENT_CLASS_TYPE
(
GameContextChanged
)
27
EVENT_CLASS_CATEGORY
(
EventCategoryGameContext
)
28
private
:
29
GameContextState
m_newState;
30
GameContextState
m_oldState;
31
};
32
33
class
EE_API
WindowResizeEvent
:
public
Event
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
55
class
EE_API
WindowCloseEvent
:
public
Event
56
{
57
public
:
58
WindowCloseEvent
() =
default
;
59
60
EVENT_CLASS_TYPE
(WindowClose)
61
EVENT_CLASS_CATEGORY
(EventCategoryApplication)
62
};
63
64
class
EE_API
WindowFocusEvent
:
public
Event
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
95
class
EE_API
AppUpdateEvent
:
public
Event
96
{
97
public
:
98
AppUpdateEvent
() =
default
;
99
100
EVENT_CLASS_TYPE
(AppUpdate)
101
EVENT_CLASS_CATEGORY
(EventCategoryApplication)
102
};
103
104
class
EE_API
AppRenderEvent
:
public
Event
105
{
106
public
:
107
AppRenderEvent
() =
default
;
108
109
EVENT_CLASS_TYPE
(AppRender)
110
EVENT_CLASS_CATEGORY
(EventCategoryApplication)
111
};
112
}
EE_API
#define EE_API
Definition
Core.h:9
Event.h
EVENT_CLASS_TYPE
#define EVENT_CLASS_TYPE(type)
Definition
Event.h:31
EVENT_CLASS_CATEGORY
#define EVENT_CLASS_CATEGORY(category)
Definition
Event.h:35
GameContext.h
Log.h
Elevate::AppRenderEvent
Definition
ApplicationEvent.h:105
Elevate::AppRenderEvent::AppRenderEvent
AppRenderEvent()=default
Elevate::AppTickEvent
Definition
ApplicationEvent.h:87
Elevate::AppTickEvent::AppTickEvent
AppTickEvent()=default
Elevate::AppUpdateEvent
Definition
ApplicationEvent.h:96
Elevate::AppUpdateEvent::AppUpdateEvent
AppUpdateEvent()=default
Elevate::Event
Definition
Event.h:38
Elevate::GameContextEvent
Definition
ApplicationEvent.h:10
Elevate::GameContextEvent::ToString
std::string ToString() const override
Definition
ApplicationEvent.h:19
Elevate::GameContextEvent::GameContextEvent
GameContextEvent()=default
Elevate::GameContextEvent::GetOldState
GameContextState GetOldState() const
Definition
ApplicationEvent.h:16
Elevate::GameContextEvent::GetNewState
GameContextState GetNewState() const
Definition
ApplicationEvent.h:17
Elevate::GameContextEvent::GameContextEvent
GameContextEvent(GameContextState oldState, GameContextState newState)
Definition
ApplicationEvent.h:13
Elevate::WindowCloseEvent
Definition
ApplicationEvent.h:56
Elevate::WindowCloseEvent::WindowCloseEvent
WindowCloseEvent()=default
Elevate::WindowFocusEvent
Definition
ApplicationEvent.h:65
Elevate::WindowFocusEvent::ToString
std::string ToString() const override
Definition
ApplicationEvent.h:73
Elevate::WindowFocusEvent::GetFocusState
bool GetFocusState() const
Definition
ApplicationEvent.h:71
Elevate::WindowFocusEvent::WindowFocusEvent
WindowFocusEvent(bool isFocused)
Definition
ApplicationEvent.h:67
Elevate::WindowResizeEvent
Definition
ApplicationEvent.h:34
Elevate::WindowResizeEvent::GetHeight
unsigned int GetHeight() const
Definition
ApplicationEvent.h:40
Elevate::WindowResizeEvent::WindowResizeEvent
WindowResizeEvent(unsigned int width, unsigned int height)
Definition
ApplicationEvent.h:36
Elevate::WindowResizeEvent::GetWidth
unsigned int GetWidth() const
Definition
ApplicationEvent.h:39
Elevate::WindowResizeEvent::ToString
std::string ToString() const override
Definition
ApplicationEvent.h:42
Elevate
Definition
AudioDistanceProbe.h:9
Elevate::EventType::GameContextChanged
@ GameContextChanged
Elevate::EventCategoryGameContext
@ EventCategoryGameContext
Definition
Event.h:28
Elevate::GameContextState
GameContextState
Definition
GameContext.h:6
ElevateEngine
src
ElevateEngine
Events
ApplicationEvent.h
Generated by
1.9.8