summaryrefslogtreecommitdiffstats
path: root/event.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'event.cpp')
-rw-r--r--event.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/event.cpp b/event.cpp
new file mode 100644
index 0000000..72de51c
--- /dev/null
+++ b/event.cpp
@@ -0,0 +1,21 @@
+#include "event.hpp"
+
+#include <optional>
+
+extern "C" {
+#include <SDL2/SDL.h>
+}
+
+wrapsdl2::event::event(const SDL_Event& e) {
+ m_event = e;
+}
+
+std::optional<wrapsdl2::event> wrapsdl2::poll_event() {
+ SDL_Event ev;
+
+ if (SDL_PollEvent(&ev) != 0) {
+ return event(ev);
+ }
+
+ return std::nullopt;
+} \ No newline at end of file