X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fsdl2%2Fg_system.pas;h=9485fd9b6e9a0897a5eb328b7232ae8f7ac8a3d9;hp=3e55f4510c99f411bfb28ad649ea34f97b278bc6;hb=4171d8dd0b8d733da27c584616e431811bf0fdcf;hpb=dbf81afaefeb52e53d2b8af3a782277229c5adaa diff --git a/src/game/sdl2/g_system.pas b/src/game/sdl2/g_system.pas index 3e55f45..9485fd9 100644 --- a/src/game/sdl2/g_system.pas +++ b/src/game/sdl2/g_system.pas @@ -42,6 +42,7 @@ implementation uses SysUtils, SDL2, Math, e_log, e_graphics, e_input, e_sound, + {$INCLUDE ../nogl/noGLuses.inc} {$IFDEF ENABLE_HOLMES} g_holmes, sdlcarcass, fui_ctls, {$ENDIF} @@ -87,7 +88,10 @@ implementation e_ResizeWindow(w, h); e_InitGL; g_Game_SetupScreenSize; - g_Menu_Reset; + {$IFNDEF ANDOIRD} + (* This will fix menu reset on keyboard showing *) + g_Menu_Reset; + {$ENDIF} g_Game_ClearLoading; {$IFDEF ENABLE_HOLMES} if assigned(oglInitCB) then oglInitCB; @@ -124,6 +128,9 @@ implementation context := SDL_GL_CreateContext(window); if context <> nil then begin + {$IFDEF USE_NOGL} + nogl_Init; + {$ENDIF} UpdateSize(w, h); result := true end @@ -445,7 +452,7 @@ implementation (* --------- Init --------- *) procedure sys_Init; - var flags: UInt32; ok: Boolean; + var flags: UInt32; begin e_WriteLog('Init SDL2', TMsgType.Notify); {$IFDEF HEADLESS} @@ -460,9 +467,6 @@ implementation SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, '0'); if SDL_Init(flags) <> 0 then raise Exception.Create('SDL: Init failed: ' + SDL_GetError); - ok := InitWindow(gScreenWidth, gScreenHeight, gBPP, gFullscreen); - if not ok then - raise Exception.Create('SDL: Failed to set videomode: ' + SDL_GetError); SDL_ShowCursor(SDL_DISABLE); end; @@ -470,11 +474,18 @@ implementation begin e_WriteLog('Releasing SDL2', TMsgType.Notify); if context <> nil then + begin + {$IFDEF USE_NOGL} + nogl_Quit; + {$ENDIF} SDL_GL_DeleteContext(context); + context := nil; + end; if window <> nil then + begin SDL_DestroyWindow(window); - window := nil; - context := nil; + window := nil; + end; SDL_Quit end;