Multiple windows work; nuklear

This commit is contained in:
John Alanbrook 2022-06-23 16:05:47 +00:00
parent 41b8632b32
commit bcecb67685
2 changed files with 18 additions and 8 deletions

View file

@ -156,11 +156,11 @@ void window_togglefullscreen(struct mSDLWindow *w)
void window_makecurrent(struct mSDLWindow *w) void window_makecurrent(struct mSDLWindow *w)
{ {
/*
if (w->window != SDL_GL_GetCurrentWindow()) if (w->window != glfwGetCurrentContext())
SDL_GL_MakeCurrent(w->window, w->glContext); glfwMakeContextCurrent(w->window);
glViewport(0, 0, w->width, w->height); glViewport(0, 0, w->width, w->height);
*/
} }
void window_swap(struct mSDLWindow *w) 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) void window_seticon(struct mSDLWindow *w, struct Texture *icon)
{ {
/*
GLFWimage images[1]; static GLFWimage images[1];
images[0] = load_icon(icon->path); images[0].width = icon->width;
images[0].height = icon->height;
images[0].pixels = icon->data;
glfwSetWindowIcon(w->window, 1, images); glfwSetWindowIcon(w->window, 1, images);
*/
} }
int window_hasfocus(struct mSDLWindow *w) int window_hasfocus(struct mSDLWindow *w)
@ -194,3 +196,10 @@ double elapsed_time()
elapsed = frame_time() - last_time; elapsed = frame_time() - last_time;
return elapsed; return elapsed;
} }
int elapsed_time_ms()
{
return elapsed_time() * 1000;
}

View file

@ -40,5 +40,6 @@ int window_hasfocus(struct mSDLWindow *w);
double frame_time(); double frame_time();
double elapsed_time(); double elapsed_time();
int elapsed_time_ms();
#endif #endif