-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 loop();
|
||||
private:
|
||||
void resize_window(XConfigureEvent *event);
|
||||
void resize_img();
|
||||
void init_img();
|
||||
void destroy_img();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
#include "windowManager/WindowManager.hpp"
|
||||
#include "noise/perlin.hpp"
|
||||
#include <X11/Xutil.h>
|
||||
#include <iostream>
|
||||
#include <X11/Xlib.h>
|
||||
#include <csignal>
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue