StevEngine
StevEngine is a customizable C++ game engine.
Loading...
Searching...
No Matches
EngineEvents.hpp
1#pragma once
2#include "EventSystem.hpp"
3#include <SDL_events.h>
4#include <SDL_keycode.h>
5
6namespace StevEngine {
10 class EngineStartEvent : public Event {
11 public:
12 EngineStartEvent() {}
13 const std::string GetEventType() const override { return GetStaticEventType(); };
14 static const std::string GetStaticEventType() { return "EngineStartEvent"; }
15 };
16
20 class EngineQuitEvent : public Event {
21 public:
22 EngineQuitEvent() {}
23 const std::string GetEventType() const override { return GetStaticEventType(); };
24 static const std::string GetStaticEventType() { return "EngineQuitEvent"; }
25 };
26
30 class PreUpdateEvent : public Event {
31 public:
32 PreUpdateEvent() {}
33 const std::string GetEventType() const override { return GetStaticEventType(); };
34 static const std::string GetStaticEventType() { return "PreUpdateEvent"; }
35 };
36
40 class UpdateEvent : public Event {
41 public:
47 const std::string GetEventType() const override { return GetStaticEventType(); };
48 static const std::string GetStaticEventType() { return "UpdateEvent"; }
49 double deltaTime;
50 };
51
52 #ifdef StevEngine_SHOW_WINDOW
56 class EngineDrawEvent : public Event {
57 public:
58 EngineDrawEvent() {}
59 const std::string GetEventType() const override { return GetStaticEventType(); };
60 static const std::string GetStaticEventType() { return "EngineDrawEvent"; }
61 };
62 #endif
63
67 class SDLEvent : public Event {
68 public:
73 SDLEvent(SDL_Event event) : event(event) {}
74 const std::string GetEventType() const override { return GetStaticEventType(); };
75 static const std::string GetStaticEventType() { return "SDLEvent"; }
76 SDL_Event event;
77 };
78
79 //Window events
80 #ifdef StevEngine_SHOW_WINDOW
84 class WindowResizeEvent : public Event {
85 public:
91 WindowResizeEvent(uint32_t width, uint32_t height) : width(width), height(height) {}
92 const std::string GetEventType() const override { return GetStaticEventType(); };
93 static const std::string GetStaticEventType() { return "WindowResizeEvent"; }
94 uint32_t width, height;
95 };
96
100 class WindowMoveEvent : public Event {
101 public:
107 WindowMoveEvent(int x, int y) : x(x), y(y) {}
108 const std::string GetEventType() const override { return GetStaticEventType(); };
109 static const std::string GetStaticEventType() { return "WindowMoveEvent"; }
110 int x, y;
111 };
112
117 public:
123 const std::string GetEventType() const override { return GetStaticEventType(); };
124 static const std::string GetStaticEventType() { return "WindowFullscreenEvent"; }
125 bool value;
126 };
127
131 class WindowVSyncEvent : public Event {
132 public:
138 const std::string GetEventType() const override { return GetStaticEventType(); };
139 static const std::string GetStaticEventType() { return "WindowVSyncEvent"; }
140 bool value;
141 };
142 #endif
143}
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:59
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:23
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:13
Base class for all engine events.
Definition EventSystem.hpp:12
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:33
SDL_Event event
Raw SDL event data.
Definition EngineEvents.hpp:76
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:74
SDLEvent(SDL_Event event)
Create SDL event wrapper.
Definition EngineEvents.hpp:73
double deltaTime
Time since last update in seconds.
Definition EngineEvents.hpp:49
UpdateEvent(double deltaTime)
Create update event.
Definition EngineEvents.hpp:46
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:47
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:123
WindowFullscreenEvent(bool value)
Create fullscreen change event.
Definition EngineEvents.hpp:122
bool value
Whether fullscreen is enabled.
Definition EngineEvents.hpp:125
WindowMoveEvent(int x, int y)
Create window move event.
Definition EngineEvents.hpp:107
int y
New window position.
Definition EngineEvents.hpp:110
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:108
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:92
uint32_t height
New window dimensions.
Definition EngineEvents.hpp:94
WindowResizeEvent(uint32_t width, uint32_t height)
Create window resize event.
Definition EngineEvents.hpp:91
WindowVSyncEvent(bool value)
Create vsync change event.
Definition EngineEvents.hpp:137
bool value
Whether vsync is enabled.
Definition EngineEvents.hpp:140
const std::string GetEventType() const override
Get type identifier for this event.
Definition EngineEvents.hpp:138