SW, KenBuild: Populate the default resolution values from the current desktop settings

git-svn-id: https://svn.eduke32.com/eduke32@7563 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-04-10 01:01:15 +00:00 committed by Christoph Oelckers
parent fdb5fabc86
commit 30d4f29b42
2 changed files with 55 additions and 3 deletions

View file

@ -11,6 +11,33 @@
#endif
#include "baselayer.h"
#if defined RENDERTYPESDL && defined SDL_TARGET && SDL_TARGET > 1
# include "sdl_inc.h"
#endif
static void Ken_SetDefaults()
{
#if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0)
SDL_Init(SDL_INIT_VIDEO);
else if (!(inited & SDL_INIT_VIDEO))
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{
xdimgame = xdim2d = dm.w;
ydimgame = ydim2d = dm.h;
}
else
#endif
{
xdimgame = xdim2d = 1024;
ydimgame = ydim2d = 768;
}
}
static int vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400},
{360,400},{640,350},{640,400},{640,480},{800,600},
{1024,768},{1280,1024},{1600,1200}};
@ -100,6 +127,8 @@ double msens;
int Ken_loadsetup(const char *fn)
{
Ken_SetDefaults();
BFILE *fp;
#define VL 32
char val[VL];

View file

@ -45,6 +45,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "_functio.h"
#include "_config.h"
#if defined RENDERTYPESDL && defined SDL_TARGET && SDL_TARGET > 1
# include "sdl_inc.h"
#endif
extern void ReadGameSetup(int32_t scripthandle);
extern void WriteGameSetup(int32_t scripthandle);
@ -201,9 +205,28 @@ void CONFIG_SetDefaults(void)
uint8_t k1,k2;
ScreenMode = 1;
ScreenWidth = 640;
ScreenHeight = 480;
ScreenBPP = 8;
#if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0)
SDL_Init(SDL_INIT_VIDEO);
else if (!(inited & SDL_INIT_VIDEO))
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{
ScreenWidth = dm.w;
ScreenHeight = dm.h;
}
else
#endif
{
ScreenWidth = 1024;
ScreenHeight = 768;
}
ScreenBPP = 32;
FXDevice = 0;
MusicDevice = 0;
NumVoices = 32;