Use the user's desktop resolution, fullscreen, as the default, instead of 1024x768 windowed.

git-svn-id: https://svn.eduke32.com/eduke32@6704 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-02-26 14:46:52 +00:00
parent 9deeb94f06
commit e26760b6af
2 changed files with 37 additions and 5 deletions

View file

@ -474,7 +474,11 @@ int main(int argc, char *argv[])
#elif defined(HAVE_GTK2) #elif defined(HAVE_GTK2)
// Pre-initialize SDL video system in order to make sure XInitThreads() is called // Pre-initialize SDL video system in order to make sure XInitThreads() is called
// before GTK starts talking to X11. // before GTK starts talking to X11.
SDL_Init(SDL_INIT_VIDEO); 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);
gtkbuild_init(&argc, &argv); gtkbuild_init(&argc, &argv);
#endif #endif
@ -597,7 +601,14 @@ int32_t initsystem(void)
if (sdlayer_checkversion()) if (sdlayer_checkversion())
return -1; return -1;
if (SDL_Init(sdlinitflags)) int32_t err = 0;
uint32_t inited = SDL_WasInit(sdlinitflags);
if (inited == 0)
err = SDL_Init(sdlinitflags);
else if ((inited & sdlinitflags) != sdlinitflags)
err = SDL_InitSubSystem(sdlinitflags & ~inited);
if (err)
{ {
initprintf("Initialization failed! (%s)\nNon-interactive mode enabled\n", SDL_GetError()); initprintf("Initialization failed! (%s)\nNon-interactive mode enabled\n", SDL_GetError());
novideo = 1; novideo = 1;

View file

@ -133,6 +133,10 @@ void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN])
} }
} }
#if defined SDL_TARGET && SDL_TARGET > 1
# include "sdl_inc.h"
#endif
void CONFIG_SetDefaults(void) void CONFIG_SetDefaults(void)
{ {
// JBF 20031211 // JBF 20031211
@ -152,11 +156,28 @@ void CONFIG_SetDefaults(void)
ud.config.ScreenWidth = droidinfo.screen_width; ud.config.ScreenWidth = droidinfo.screen_width;
ud.config.ScreenHeight = droidinfo.screen_height; ud.config.ScreenHeight = droidinfo.screen_height;
#else #else
ud.config.ScreenWidth = 1024; # if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1
ud.config.ScreenHeight = 768; 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)
{
ud.config.ScreenWidth = dm.w;
ud.config.ScreenHeight = dm.h;
}
else
# endif
{
ud.config.ScreenWidth = 1024;
ud.config.ScreenHeight = 768;
}
#endif #endif
ud.config.ScreenMode = 0; ud.config.ScreenMode = 1;
#ifdef USE_OPENGL #ifdef USE_OPENGL
ud.config.ScreenBPP = 32; ud.config.ScreenBPP = 32;