sdl_impl: Mark FromEvent() as a const member function

This doesn't modify internal member state, so it can be marked as const.
This commit is contained in:
Lioncash 2020-08-28 20:58:29 -04:00
parent 57d9ef5a89
commit 2680526e6b

View file

@ -784,7 +784,7 @@ public:
} }
return {}; return {};
} }
std::optional<Common::ParamPackage> FromEvent(const SDL_Event& event) { [[nodiscard]] std::optional<Common::ParamPackage> FromEvent(const SDL_Event& event) const {
switch (event.type) { switch (event.type) {
case SDL_JOYAXISMOTION: case SDL_JOYAXISMOTION:
if (std::abs(event.jaxis.value / 32767.0) < 0.5) { if (std::abs(event.jaxis.value / 32767.0) < 0.5) {
@ -795,7 +795,7 @@ public:
case SDL_JOYHATMOTION: case SDL_JOYHATMOTION:
return {SDLEventToButtonParamPackage(state, event)}; return {SDLEventToButtonParamPackage(state, event)};
} }
return {}; return std::nullopt;
} }
}; };