diff --git a/includes/windowManager/WindowManager.hpp b/includes/windowManager/WindowManager.hpp index 41f87ee..b1a90c1 100644 --- a/includes/windowManager/WindowManager.hpp +++ b/includes/windowManager/WindowManager.hpp @@ -17,6 +17,7 @@ public: void load_render(renderFunction r); void loop(); private: + void resize_window(XConfigureEvent *event); void resize_img(); void init_img(); void destroy_img(); diff --git a/srcs/windowManager/WindowManager.cpp b/srcs/windowManager/WindowManager.cpp index 8de2212..f954e59 100644 --- a/srcs/windowManager/WindowManager.cpp +++ b/srcs/windowManager/WindowManager.cpp @@ -1,9 +1,7 @@ #include "windowManager/WindowManager.hpp" -#include "noise/perlin.hpp" #include #include #include -#include WindowManager::WindowManager(int width, int height, renderFunction render) : render(render), @@ -70,16 +68,19 @@ void WindowManager::handle_events(XEvent &GeneralEvent) { } break; case ConfigureNotify: { - XConfigureEvent *event = (XConfigureEvent *)&GeneralEvent; - if (event->width != this->WindowWidth || event->height != this->WindowHeight) { - this->WindowWidth = event->width; - this->WindowHeight = event->height; - this->resize_img(); - } + this->resize_window((XConfigureEvent *)&GeneralEvent); } break; } } +void WindowManager::resize_window(XConfigureEvent *event) { + if (event->width != this->WindowWidth || event->height != this->WindowHeight) { + this->WindowWidth = event->width; + this->WindowHeight = event->height; + this->resize_img(); + } +} + void WindowManager::loop() { while (isWindowOpen) { while (XPending(this->MainDisplay) > 0)