summaryrefslogtreecommitdiffhomepage
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/events.cpp17
-rw-r--r--main/precomp.hpp1
2 files changed, 13 insertions, 5 deletions
diff --git a/main/events.cpp b/main/events.cpp
index ad7e64d1..0344f1a1 100644
--- a/main/events.cpp
+++ b/main/events.cpp
@@ -2,7 +2,7 @@
#include "floormat/app.hpp"
#include "floormat/events.hpp"
#include <SDL_events.h>
-#include <SDL_video.h>
+//#include <SDL_video.h>
namespace floormat {
@@ -72,6 +72,14 @@ void main_impl::keyReleaseEvent(Platform::Sdl2Application::KeyEvent& event)
false);
}
+static any_event make_any_event(const SDL_Event& e)
+{
+ static_assert(sizeof(SDL_Event) <= sizeof(any_event::buf));
+ any_event ret;
+ std::memcpy(&ret.buf, &e, sizeof(SDL_Event));
+ return ret;
+}
+
void main_impl::anyEvent(SDL_Event& event)
{
if (event.type == SDL_WINDOWEVENT)
@@ -87,12 +95,13 @@ void main_impl::anyEvent(SDL_Event& event)
return app.on_mouse_leave();
case SDL_WINDOWEVENT_ENTER:
return app.on_mouse_enter();
- default:
- return app.on_any_event({event});
+ default: {
+ return app.on_any_event(make_any_event(event));
+ }
}
}
else
- return app.on_any_event({event});
+ return app.on_any_event(make_any_event(event));
}
} // namespace floormat
diff --git a/main/precomp.hpp b/main/precomp.hpp
index 734fc72b..68e8c965 100644
--- a/main/precomp.hpp
+++ b/main/precomp.hpp
@@ -14,6 +14,5 @@
#if __has_include(<SDL.h>)
#include <SDL_keycode.h>
-#include <SDL_mouse.h>
#include <SDL_events.h>
#endif