index 5e91cc0f285e0dfbeb08bea4a3e2e4227bbc6f18..aacb4fb09133cd58e18d1c4c4ab2e946db1fc282 100644 (file)
uses
SysUtils, SDL2, Math, ctypes,
- e_log, r_graphics, e_input, e_sound,
- {$INCLUDE ../nogl/noGLuses.inc}
+ e_log, e_input, e_sound,
{$IFDEF ENABLE_HOLMES}
- g_holmes, sdlcarcass, fui_ctls,
+ sdlcarcass,
{$ENDIF}
- g_touch, g_options, g_console, g_game, g_menu, g_gui, g_basic;
+ g_touch, g_options, g_console, g_game, g_basic
+ ;
const
GameTitle = 'Doom 2D: Forever (SDL 2, %s)';
(* --------- Graphics --------- *)
- function LoadGL: Boolean;
- var ltmp: Integer;
- begin
- result := true;
- {$IFDEF NOGL_INIT}
- nogl_Init;
- if glRenderToFBO and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then
- begin
- e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering');
- glRenderToFBO := false;
- end;
- {$ELSE}
- if glRenderToFBO and (not Load_GL_ARB_framebuffer_object) then
- begin
- e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering');
- glRenderToFBO := false;
- end;
- {$ENDIF}
- if SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, @ltmp) = 0 then
- begin
- e_LogWritefln('stencil buffer size: %s', [ltmp]);
- gwin_has_stencil := (ltmp > 0);
- end;
- end;
-
- procedure FreeGL;
- begin
- {$IFDEF NOGL_INIT}
- nogl_Quit();
- {$ENDIF}
- end;
-
function GetTitle (): AnsiString;
var info: AnsiString;
begin
context := SDL_GL_CreateContext(window);
if context <> nil then
begin
- if not LoadGL then
- begin
- e_LogWriteln('GL: unable to load OpenGL functions', TMsgType.Fatal);
- SDL_GL_DeleteContext(context); context := nil;
- exit;
- end;
if (fullscreen = false) and (maximized = false) and (wc = false) then
begin
SDL_GetWindowPosition(window, @x, @y);
e_WriteLog('Releasing SDL2', TMsgType.Notify);
if context <> nil then
begin
- FreeGL;
SDL_GL_DeleteContext(context);
context := nil;
end;