-clean: resize window
This commit is contained in:
parent
cb3b349472
commit
214bbffa7e
2 changed files with 10 additions and 8 deletions
|
|
@ -17,6 +17,7 @@ public:
|
||||||
void load_render(renderFunction r);
|
void load_render(renderFunction r);
|
||||||
void loop();
|
void loop();
|
||||||
private:
|
private:
|
||||||
|
void resize_window(XConfigureEvent *event);
|
||||||
void resize_img();
|
void resize_img();
|
||||||
void init_img();
|
void init_img();
|
||||||
void destroy_img();
|
void destroy_img();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
#include "windowManager/WindowManager.hpp"
|
#include "windowManager/WindowManager.hpp"
|
||||||
#include "noise/perlin.hpp"
|
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <csignal>
|
|
||||||
|
|
||||||
WindowManager::WindowManager(int width, int height, renderFunction render) :
|
WindowManager::WindowManager(int width, int height, renderFunction render) :
|
||||||
render(render),
|
render(render),
|
||||||
|
|
@ -70,14 +68,17 @@ void WindowManager::handle_events(XEvent &GeneralEvent) {
|
||||||
} break;
|
} break;
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
{
|
{
|
||||||
XConfigureEvent *event = (XConfigureEvent *)&GeneralEvent;
|
this->resize_window((XConfigureEvent *)&GeneralEvent);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowManager::resize_window(XConfigureEvent *event) {
|
||||||
if (event->width != this->WindowWidth || event->height != this->WindowHeight) {
|
if (event->width != this->WindowWidth || event->height != this->WindowHeight) {
|
||||||
this->WindowWidth = event->width;
|
this->WindowWidth = event->width;
|
||||||
this->WindowHeight = event->height;
|
this->WindowHeight = event->height;
|
||||||
this->resize_img();
|
this->resize_img();
|
||||||
}
|
}
|
||||||
} break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::loop() {
|
void WindowManager::loop() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue