(D3D) reimplement resizing

This commit is contained in:
twinaphex 2015-11-11 02:17:18 +01:00
parent f76d9f255a
commit 47496ff0c3
1 changed files with 14 additions and 12 deletions

View File

@ -48,6 +48,7 @@ static bool widescreen_mode = false;
static d3d_video_t *curD3D = NULL; static d3d_video_t *curD3D = NULL;
static bool d3d_quit = false; static bool d3d_quit = false;
static void *dinput; static void *dinput;
static bool g_d3d_resized;
extern bool d3d_restore(d3d_video_t *data); extern bool d3d_restore(d3d_video_t *data);
@ -114,11 +115,9 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT message,
/* Do not send resize message if we minimize. */ /* Do not send resize message if we minimize. */
if (wparam != SIZE_MAXHIDE && wparam != SIZE_MINIMIZED) if (wparam != SIZE_MAXHIDE && wparam != SIZE_MINIMIZED)
{ {
unsigned new_width = LOWORD(lparam); g_resize_width = LOWORD(lparam);
unsigned new_height = HIWORD(lparam); g_resize_height = HIWORD(lparam);
g_d3d_resized = true;
if (new_width && new_height)
d3d_resize(driver->video_data, new_width, new_height);
} }
return 0; return 0;
case WM_COMMAND: case WM_COMMAND:
@ -187,17 +186,20 @@ static void gfx_ctx_d3d_check_window(void *data, bool *quit,
bool *resize, unsigned *width, bool *resize, unsigned *width,
unsigned *height, unsigned frame_count) unsigned *height, unsigned frame_count)
{ {
d3d_video_t *d3d = (d3d_video_t*)data; win32_check_window();
(void)data; (void)data;
(void)frame_count;
*quit = false; *quit = d3d_quit;
*resize = false;
if (d3d_quit) if (g_d3d_resized)
*quit = true; {
if (d3d->should_resize) *resize = true;
*resize = true; *width = g_d3d_resize_width;
*height = g_d3d_resize_height;
g_d3d_resized = false;
}
win32_check_window(); win32_check_window();
} }