X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_main.pas;h=c789caf7785c74a09a79e9e691f62b6277898551;hb=a9ab7bf0c72e15b932b20aad24b10db60138bb21;hp=9a7250f9fc28a21b9933dfaa61123c4587f70fe7;hpb=f4fc3b435118e5d9e4085da37014436d2e063259;p=d2df-sdl.git diff --git a/src/game/g_main.pas b/src/game/g_main.pas index 9a7250f..c789caf 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -37,18 +37,17 @@ var implementation uses -{$IFDEF USE_NANOGL} - nanoGL, -{$ELSE} - GL, GLExt, +{$INCLUDE ../nogl/noGLuses.inc} +{$IFDEF ENABLE_HOLMES} + g_holmes, fui_wadread, fui_style, fui_gfx_gl, {$ENDIF} SDL2, wadreader, e_log, g_window, e_graphics, e_input, g_game, g_console, g_gui, e_sound, g_options, g_sound, g_player, g_basic, g_weapons, SysUtils, g_triggers, MAPDEF, g_map, - g_menu, g_language, g_net, g_holmes, - utils, conbuf, envvars, fui_wadread, fui_style, - fui_gfx_gl, xparser; + g_menu, g_language, g_net, g_touch, + utils, conbuf, envvars, + xparser; var @@ -57,7 +56,7 @@ var procedure Main(); var sdlflags: LongWord; -{$IFNDEF HEADLESS} +{$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)} flexloaded: Boolean; {$ENDIF} begin @@ -81,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; @@ -112,14 +101,29 @@ begin sdlflags := SDL_INIT_JOYSTICK or SDL_INIT_TIMER or SDL_INIT_VIDEO; {$ENDIF} {$ENDIF} + + SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, '0'); + 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(); {$ENDIF} +{$ENDIF} -{$IFNDEF HEADLESS} +{$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)} flexloaded := true; if not fuiAddWad('flexui.wad') then begin @@ -196,6 +200,7 @@ begin e_WriteLog('Init Input', TMsgType.Notify); e_InitInput(); + g_Touch_Init; if (e_JoysticksAvailable > 0) then e_WriteLog('Input: Joysticks available.', TMsgType.Notify) @@ -489,12 +494,12 @@ begin if (g_ActiveWindow = nil) then g_Game_Pause(not gPause); end; - IK_BACKQUOTE: // <`/~/¨/¸>: + IK_BACKQUOTE, VK_CONSOLE: // <`/~/¨/¸>: begin g_Console_Switch(); end; - IK_ESCAPE: // : + IK_ESCAPE, VK_ESCAPE: // : begin if gChatShow then begin