From bcecb676856a712d8fe16d0b4ff1479595bf36c6 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Thu, 23 Jun 2022 16:05:47 +0000 Subject: [PATCH] Multiple windows work; nuklear --- source/engine/window.c | 25 +++++++++++++++++-------- source/engine/window.h | 1 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/source/engine/window.c b/source/engine/window.c index 1bc4c49..c8254d5 100755 --- a/source/engine/window.c +++ b/source/engine/window.c @@ -156,11 +156,11 @@ void window_togglefullscreen(struct mSDLWindow *w) void window_makecurrent(struct mSDLWindow *w) { -/* - if (w->window != SDL_GL_GetCurrentWindow()) - SDL_GL_MakeCurrent(w->window, w->glContext); + + if (w->window != glfwGetCurrentContext()) + glfwMakeContextCurrent(w->window); glViewport(0, 0, w->width, w->height); -*/ + } void window_swap(struct mSDLWindow *w) @@ -170,11 +170,13 @@ void window_swap(struct mSDLWindow *w) void window_seticon(struct mSDLWindow *w, struct Texture *icon) { -/* - GLFWimage images[1]; - images[0] = load_icon(icon->path); + + static GLFWimage images[1]; + images[0].width = icon->width; + images[0].height = icon->height; + images[0].pixels = icon->data; glfwSetWindowIcon(w->window, 1, images); -*/ + } int window_hasfocus(struct mSDLWindow *w) @@ -194,3 +196,10 @@ double elapsed_time() elapsed = frame_time() - last_time; return elapsed; } + +int elapsed_time_ms() +{ + return elapsed_time() * 1000; +} + + diff --git a/source/engine/window.h b/source/engine/window.h index 7022d88..07aec86 100755 --- a/source/engine/window.h +++ b/source/engine/window.h @@ -40,5 +40,6 @@ int window_hasfocus(struct mSDLWindow *w); double frame_time(); double elapsed_time(); +int elapsed_time_ms(); #endif