PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
application_event.h
1#pragma once
2
3#include "pixelbullet/application/event.h"
4
5#include <sstream>
6
7namespace pixelbullet
8{
9class WindowResizeEvent : public Event
10{
11public:
12 WindowResizeEvent(unsigned int width, unsigned int height)
13 : width_(width)
14 , height_(height)
15 {
16 }
17
18 unsigned int GetWidth() const
19 {
20 return width_;
21 }
22 unsigned int GetHeight() const
23 {
24 return height_;
25 }
26
27 std::string ToString() const override
28 {
29 std::stringstream ss;
30 ss << "WindowResizeEvent: " << width_ << ", " << height_;
31 return ss.str();
32 }
33
34 EVENT_CLASS_TYPE(WindowResize)
35 EVENT_CLASS_CATEGORY(EventCategoryApplication)
36private:
37 unsigned int width_, height_;
38};
39
40class WindowCloseEvent : public Event
41{
42public:
43 WindowCloseEvent() = default;
44
45 EVENT_CLASS_TYPE(WindowClose)
46 EVENT_CLASS_CATEGORY(EventCategoryApplication)
47};
48
49class WindowFocusEvent : public Event
50{
51public:
52 WindowFocusEvent() = default;
53
54 EVENT_CLASS_TYPE(WindowFocus)
55 EVENT_CLASS_CATEGORY(EventCategoryApplication)
56};
57
59{
60public:
61 WindowLostFocusEvent() = default;
62
63 EVENT_CLASS_TYPE(WindowLostFocus)
64 EVENT_CLASS_CATEGORY(EventCategoryApplication)
65};
66
67class WindowMovedEvent : public Event
68{
69public:
70 WindowMovedEvent(int x, int y)
71 : x_(x)
72 , y_(y)
73 {
74 }
75
76 int GetX() const
77 {
78 return x_;
79 }
80 int GetY() const
81 {
82 return y_;
83 }
84
85 std::string ToString() const override
86 {
87 std::stringstream ss;
88 ss << "WindowMovedEvent: " << x_ << ", " << y_;
89 return ss.str();
90 }
91
92 EVENT_CLASS_TYPE(WindowMoved)
93 EVENT_CLASS_CATEGORY(EventCategoryApplication)
94
95private:
96 int x_ = 0;
97 int y_ = 0;
98};
99
100class AppTickEvent : public Event
101{
102public:
103 AppTickEvent() = default;
104
105 EVENT_CLASS_TYPE(AppTick)
106 EVENT_CLASS_CATEGORY(EventCategoryApplication)
107};
108
109class AppUpdateEvent : public Event
110{
111public:
112 AppUpdateEvent() = default;
113
114 EVENT_CLASS_TYPE(AppUpdate)
115 EVENT_CLASS_CATEGORY(EventCategoryApplication)
116};
117
118class AppRenderEvent : public Event
119{
120public:
121 AppRenderEvent() = default;
122
123 EVENT_CLASS_TYPE(AppRender)
124 EVENT_CLASS_CATEGORY(EventCategoryApplication)
125};
126
127} // namespace pixelbullet
Definition application_event.h:119
Definition application_event.h:101
Definition application_event.h:110
Definition event.h:72
Definition application_event.h:41
Definition application_event.h:50
Definition application_event.h:59
Definition application_event.h:68
Definition application_event.h:10