summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2013-10-28 01:23:10 +0000
committerSimon Howard2013-10-28 01:23:10 +0000
commit552d300e2615bae577a629c9e738ebc27d906f27 (patch)
tree4db3831d7fb2f5577e11417c53033e69dd53733d
parent79c6c5e83d95f202f62ec01eb55310a03c8f9265 (diff)
downloadchocolate-doom-552d300e2615bae577a629c9e738ebc27d906f27.tar.gz
chocolate-doom-552d300e2615bae577a629c9e738ebc27d906f27.tar.bz2
chocolate-doom-552d300e2615bae577a629c9e738ebc27d906f27.zip
Determine which textscreen font to use by looking at the current desktop
screen resolution, not the largest fullscreen resolution offered by SDL. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2724
-rw-r--r--textscreen/txt_sdl.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c
index c51fcaf3..d098d196 100644
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -151,9 +151,8 @@ static txt_font_t *FontForName(char *name)
static void ChooseFont(void)
{
- SDL_Rect **modes;
+ const SDL_VideoInfo *info;
char *env;
- int i;
// Allow normal selection to be overridden from an environment variable:
@@ -169,14 +168,14 @@ static void ChooseFont(void)
}
}
- // Check all modes
+ // Get desktop resolution:
- modes = SDL_ListModes(NULL, SDL_FULLSCREEN);
+ info = SDL_GetVideoInfo();
// If in doubt and we can't get a list, always prefer to
// fall back to the normal font:
- if (modes == NULL || modes == (SDL_Rect **) -1 || *modes == NULL)
+ if (info == NULL)
{
#ifdef _WIN32_WCE
font = &small_font;
@@ -186,24 +185,22 @@ static void ChooseFont(void)
return;
}
- // Scan through the list of modes. If we find no modes that are at
- // least 640x480 in side, default to the small font. If we find one
- // mode that is at least 1920x1080, this is a modern high-resolution
- // display, and we can use the large font.
+ // On tiny low-res screens (eg. palmtops) use the small font.
+ // If the screen resolution is at least 1920x1080, this is
+ // a modern high-resolution display, and we can use the
+ // large font.
- font = &small_font;
-
- for (i=0; modes[i] != NULL; ++i)
+ if (info->current_w < 640 || info->current_h < 480)
{
- if (modes[i]->w >= 1920 && modes[i]->h >= 1080)
- {
- font = &large_font;
- break;
- }
- else if (modes[i]->w >= 640 && modes[i]->h >= 480)
- {
- font = &main_font;
- }
+ font = &small_font;
+ }
+ else if (info->current_w >= 1920 && info->current_h >= 1080)
+ {
+ font = &large_font;
+ }
+ else
+ {
+ font = &main_font;
}
}