diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index 061e3a8ee..42ffd69eb 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -34,8 +34,8 @@ static SDL_Window *wnd; static SDL_GLContext ctx; static int inverted_scancode_table[512]; static int vsync_enabled = 0; -static unsigned int window_width = DESIRED_SCREEN_WIDTH; -static unsigned int window_height = DESIRED_SCREEN_HEIGHT; +static int window_width = DESIRED_SCREEN_WIDTH; +static int window_height = DESIRED_SCREEN_HEIGHT; static bool fullscreen_state; static void (*on_fullscreen_changed_callback)(bool is_now_fullscreen); static bool (*on_key_down_callback)(int scancode); @@ -145,7 +145,8 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen) { int len = sprintf(title, "%s (%s)", game_name, GFX_API_NAME); wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); + window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); + SDL_GL_GetDrawableSize(wnd, &window_width, &window_height); if (start_in_fullscreen) { set_fullscreen(true, false); @@ -244,8 +245,7 @@ static void gfx_sdl_handle_events(void) { #endif case SDL_WINDOWEVENT: if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { - window_width = event.window.data1; - window_height = event.window.data2; + SDL_GL_GetDrawableSize(wnd, &window_width, &window_height); } break; case SDL_QUIT: