From a98de6d71f752204e512f85d0a722eedc8c3b130 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Fri, 13 Jan 2023 19:21:09 +0700 Subject: [PATCH] textscreen updates (#872) * Resizable textscreen windows. * Increase the default window size to 800x600. * Correct aspect ratio in textscreen windows. * Remove aspect ratio correction. --- src/m_misc.c | 4 ++-- textscreen/txt_sdl.c | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 9b09c2eb..5ae11ed1 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2453,7 +2453,7 @@ default_t defaults[] = { { "window_width", (config_t *) &window_width, NULL, - {640}, {0, UL}, number, ss_none, wad_no, + {800}, {0, UL}, number, ss_none, wad_no, "window width" }, @@ -2461,7 +2461,7 @@ default_t defaults[] = { { "window_height", (config_t *) &window_height, NULL, - {480}, {0, UL}, number, ss_none, wad_no, + {600}, {0, UL}, number, ss_none, wad_no, "window height" }, diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index b7ee96d0..1cce4b37 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -262,9 +262,24 @@ int TXT_Init(void) if (TXT_SDLWindow == NULL) { + int w, h; + + if (font == &normal_font || font == &highdpi_font) + { + w = 3 * screen_image_w / 2; + h = 3 * screen_image_h / 2; + } + else + { + w = screen_image_w; + h = screen_image_h; + } + flags |= SDL_WINDOW_RESIZABLE; + TXT_SDLWindow = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, - screen_image_w, screen_image_h, flags); + w, h, flags); + SDL_SetWindowMinimumSize(TXT_SDLWindow, screen_image_w, screen_image_h); } if (TXT_SDLWindow == NULL) @@ -431,9 +446,6 @@ static int LimitToRange(int val, int min, int max) static void GetDestRect(SDL_Rect *rect) { - int w, h; - - SDL_GetRendererOutputSize(renderer, &w, &h); // Set x and y to 0 due to SDL auto-centering. rect->x = 0; rect->y = 0;