textscreen updates (#872)

* Resizable textscreen windows.

* Increase the default window size to 800x600.

* Correct aspect ratio in textscreen windows.

* Remove aspect ratio correction.
This commit is contained in:
Roman Fomin 2023-01-13 19:21:09 +07:00 committed by GitHub
parent c950a3b014
commit a98de6d71f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View File

@ -2453,7 +2453,7 @@ default_t defaults[] = {
{ {
"window_width", "window_width",
(config_t *) &window_width, NULL, (config_t *) &window_width, NULL,
{640}, {0, UL}, number, ss_none, wad_no, {800}, {0, UL}, number, ss_none, wad_no,
"window width" "window width"
}, },
@ -2461,7 +2461,7 @@ default_t defaults[] = {
{ {
"window_height", "window_height",
(config_t *) &window_height, NULL, (config_t *) &window_height, NULL,
{480}, {0, UL}, number, ss_none, wad_no, {600}, {0, UL}, number, ss_none, wad_no,
"window height" "window height"
}, },

View File

@ -262,9 +262,24 @@ int TXT_Init(void)
if (TXT_SDLWindow == NULL) 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("", TXT_SDLWindow = SDL_CreateWindow("",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 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) if (TXT_SDLWindow == NULL)
@ -431,9 +446,6 @@ static int LimitToRange(int val, int min, int max)
static void GetDestRect(SDL_Rect *rect) 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. // Set x and y to 0 due to SDL auto-centering.
rect->x = 0; rect->x = 0;
rect->y = 0; rect->y = 0;