summaryrefslogtreecommitdiffstats
path: root/event.cpp
blob: 72de51c5369f4f55060252859fc25468a11ca1cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}