From 62c5dfb0a8b9a63f2faabce4ea0098429f14b238 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Thu, 17 Apr 2025 19:17:02 +0900 Subject: [PATCH] fixing undocumented part of win32 api --- engine/graphic/opengl/wgl/gf_draw.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/engine/graphic/opengl/wgl/gf_draw.c b/engine/graphic/opengl/wgl/gf_draw.c index 23cf27d..450120a 100644 --- a/engine/graphic/opengl/wgl/gf_draw.c +++ b/engine/graphic/opengl/wgl/gf_draw.c @@ -36,13 +36,15 @@ LRESULT CALLBACK gf_draw_platform_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp EndPaint(hWnd, &ps); break; case WM_SIZE: - GetClientRect(hWnd, &rect); - draw->x = rect.left; - draw->y = rect.top; - draw->width = rect.right - rect.left; - draw->height = rect.bottom - rect.top; - wglMakeCurrent(draw->platform->dc, draw->platform->glrc); - gf_draw_reshape(draw); + if(draw->platform != NULL) { + GetClientRect(hWnd, &rect); + draw->x = rect.left; + draw->y = rect.top; + draw->width = rect.right - rect.left; + draw->height = rect.bottom - rect.top; + wglMakeCurrent(draw->platform->dc, draw->platform->glrc); + gf_draw_reshape(draw); + } break; case WM_CLOSE: draw->close = 1;