From 9be9512e85245d840a56816a416ae687858aff46 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Mon, 24 Oct 2022 20:19:48 +0000 Subject: [PATCH] Removed arrlen and arrwalk, which do not work --- source/engine/window.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/source/engine/window.c b/source/engine/window.c index 86fcb42..8cd46ec 100644 --- a/source/engine/window.c +++ b/source/engine/window.c @@ -1,4 +1,4 @@ -#include "window.h" + #include "window.h" #include #include "texture.h" #include "log.h" @@ -26,27 +26,36 @@ void window_size_callback(GLFWwindow *w) } +struct mSDLWindow *winfind(GLFWwindow *w) +{ + for (int i = 0; i < arrlen(windows); i++) { + if (windows[i].window == w) + return &windows[i]; + } + + return NULL; +} + void window_iconify_callback(GLFWwindow *w, int iconified) { - struct mSDLWindow *win = arrfind(windows, is_win, w); + struct mSDLWindow *win = winfind(w); win->iconified = iconified; } void window_focus_callback(GLFWwindow *w, int focused) { - struct mSDLWindow *win = arrfind(windows, is_win, w); - win->keyboardFocus = focused; -} + struct mSDLWindow *win = winfind(w); + } void window_maximize_callback(GLFWwindow *w, int maximized) { - struct mSDLWindow *win = arrfind(windows, is_win, w); + struct mSDLWindow *win = winfind(w); win->minimized = !maximized; } void window_framebuffer_size_cb(GLFWwindow *w, int width, int height) { - struct mSDLWindow *win = arrfind(windows, is_win, w); + struct mSDLWindow *win = winfind(w); win->width = width; win->height = height; window_makecurrent(win); @@ -270,6 +279,7 @@ void window_render(struct mSDLWindow *w) { if (script_has_sym(w->nuke_cb)) { nuke_start(); script_call_sym(w->nuke_cb); + nk_end(ctx); nuke_end(); } else if (w->nuke_gui != NULL) { nuke_start(); @@ -282,5 +292,7 @@ void window_render(struct mSDLWindow *w) { } void window_renderall() { - arrwalk(windows, window_render); + //arrwalk(windows, window_render); + for (int i = 0; i < arrlen(windows); i++) + window_render(&windows[i]); } \ No newline at end of file