aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index 43dd6cc..4731261 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -8,11 +8,10 @@
#include <render.hpp>
#include <engine.hpp>
#include <events.hpp>
+#include <window.hpp>
extern Menu* currentMenu;
-extern SDL_Window *window;
-
std::array<SDL_Keycode, 6> controlMap = {
SDLK_w, SDLK_a, SDLK_d, SDLK_LSHIFT, SDLK_LCTRL, SDLK_e
};
@@ -1244,6 +1243,19 @@ void InputSystem::update(entityx::EntityManager &en, entityx::EventManager &ev,
case SDL_QUIT:
game::endGame();
break;
+
+ // window events - used for resizing and stuff
+ case SDL_WINDOWEVENT:
+ switch (e.window.event) {
+ case SDL_WINDOWEVENT_RESIZED:
+ std::cout << "Window " << e.window.windowID << " resized to: " << e.window.data1 << ", " << e.window.data2 << std::endl;
+ auto w = e.window.data1;
+ auto h = e.window.data2;
+ ev.emit<WindowResizeEvent>(w,h);
+ break;
+ }
+ break;
+
// mouse movement - update mouse vector
case SDL_MOUSEMOTION: