From: DeaDDooMER Date: Sun, 24 Jun 2018 13:08:26 +0000 (+0300) Subject: Android: fix bad screen size when config not found X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=1e27a158ab2d7b1041d932308b6f39aa3e22655f;p=d2df-sdl.git Android: fix bad screen size when config not found --- diff --git a/src/game/g_main.pas b/src/game/g_main.pas index 34de5cf..bb394f1 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -80,21 +80,11 @@ begin TMsgType.Notify ); - e_WriteLog('Read config file', TMsgType.Notify); - g_Options_Read(GameDir + '/' + CONFIG_FILENAME); - {$IFDEF HEADLESS} conbufDumpToStdOut := true; {$ENDIF} e_WriteToStdOut := False; //{$IFDEF HEADLESS}True;{$ELSE}False;{$ENDIF} - //GetSystemDefaultLCID() - - //e_WriteLog('Read language file', MSG_NOTIFY); - //g_Language_Load(DataDir + gLanguage + '.txt'); - e_WriteLog(gLanguage, TMsgType.Notify); - g_Language_Set(gLanguage); - {$IFDEF HEADLESS} {$IFDEF USE_SDLMIXER} sdlflags := SDL_INIT_TIMER or SDL_INIT_AUDIO or $00004000; @@ -117,6 +107,16 @@ begin if SDL_Init(sdlflags) < 0 then raise Exception.Create('SDL: Init failed: ' + SDL_GetError()); + e_WriteLog('Read config file', TMsgType.Notify); + g_Options_Read(GameDir + '/' + CONFIG_FILENAME); + + //GetSystemDefaultLCID() + + //e_WriteLog('Read language file', MSG_NOTIFY); + //g_Language_Load(DataDir + gLanguage + '.txt'); + e_WriteLog(gLanguage, TMsgType.Notify); + g_Language_Set(gLanguage); + {$IFNDEF HEADLESS} {$IFNDEF ANDROID} SDL_StartTextInput(); diff --git a/src/game/g_options.pas b/src/game/g_options.pas index 42b3ef7..493e07c 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -142,12 +142,12 @@ uses procedure g_Options_SetDefaultVideo; {$IF DEFINED(ANDROID)} var - display: PSDL_DisplayMode; + display: TSDL_DisplayMode; {$ENDIF} begin {$IF DEFINED(ANDROID)} (* On android set max screen size *) - SDL_GetCurrentDisplayMode(0, display); + SDL_GetCurrentDisplayMode(0, @display); gScreenWidth := display.w; gScreenHeight := display.h; gWinRealPosX := 0; @@ -171,6 +171,7 @@ begin gTextureFilter := True; glLegacyNPOT := False; {$ENDIF} + e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight)); end; procedure g_Options_SetDefault();