summaryrefslogtreecommitdiffstats
path: root/event.cpp
blob: 60d432eabd05ddd75e090789281191d2bd3537f5 (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>
}

wsdl2::event::event(const SDL_Event& e) {
    m_event = e;
}

std::optional<wsdl2::event> wsdl2::poll_event() {
    SDL_Event ev;

    if (SDL_PollEvent(&ev) != 0) {
        return event(ev);
    }

    return std::nullopt;
}