diff options
Diffstat (limited to '')
-rw-r--r-- | event.cpp | 21 |
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 |