summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fc26b29)
raw | patch | inline | side by side (parent: fc26b29)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 12 Feb 2018 11:46:47 +0000 (13:46 +0200) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 12 Feb 2018 11:47:34 +0000 (13:47 +0200) |
src/game/g_menu.pas | patch | blob | history | |
src/game/g_window.pas | patch | blob | history |
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index ff57a392880a97a2b1bdb2514b6272240288b007..0a9cc7f395614e11759408dd027d5807d0298784 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
menu: TGUIMenu;
i: Integer;
ovs: Boolean;
- v: Byte;
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
ovs := gVSync;
gVSync := TGUISwitch(menu.GetControl('swVSync')).ItemIndex = 0;
- {$IF not DEFINED(HEADLESS)}
- if (ovs <> gVSync) then
- begin
- if (gVSync) then v := 1 else v := 0;
- if (SDL_GL_SetSwapInterval(v) <> 0) then writeln('oops; can''t change vsync option, restart required')
- else writeln('vsync changed');
- end;
- {$ENDIF}
+ if (ovs <> gVSync) then g_SetVSync(gVSync);
gTextureFilter := TGUISwitch(menu.GetControl('swTextureFilter')).ItemIndex = 0;
glLegacyNPOT := not (TGUISwitch(menu.GetControl('swLegacyNPOT')).ItemIndex = 0);
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index e2fec17af124ea35f5c6a556e0536196d84a8a2f..56df2d169d730e2526a2d373328f85436675c0b1 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
function GetDisplayModes (dbpp: LongWord; var selres: LongWord): SSArray;
function g_Window_SetDisplay (preserveGL: Boolean=false): Boolean;
function g_Window_SetSize (w, h: Word; fullscreen: Boolean): Boolean;
+procedure g_SetVSync (vsync: Boolean);
procedure ProcessLoading (forceUpdate: Boolean=false);
fuiScrWdt := gScreenWidth;
fuiScrHgt := gScreenHeight;
if (assigned(oglInitCB)) then oglInitCB();
+ g_SetVSync(gVSync);
{$ENDIF}
e_ResizeWindow(gScreenWidth, gScreenHeight);
end;
-procedure InitOpenGL (vsync: Boolean);
+procedure g_SetVSync (vsync: Boolean);
{$IF not DEFINED(HEADLESS)}
var
v: Byte;
begin
{$IF not DEFINED(HEADLESS)}
if vsync then v := 1 else v := 0;
+ if (SDL_GL_SetSwapInterval(v) <> 0) then
+ begin
+ e_WriteLog('oops; can''t change vsync option, restart required', TMsgType.Warning);
+ end
+ else
+ begin
+ if vsync then e_WriteLog('VSync: ON', TMsgType.Notify) else e_WriteLog('VSync: OFF', TMsgType.Notify);
+ end;
+{$ENDIF}
+end;
+
+
+procedure InitOpenGL ();
+begin
+{$IF not DEFINED(HEADLESS)}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); // lights; it is enough to have 1-bit stencil buffer for lighting, but...
- SDL_GL_SetSwapInterval(v);
{$ENDIF}
end;
end;
e_WriteLog('Initializing OpenGL', TMsgType.Notify);
- InitOpenGL(gVSync);
+ InitOpenGL();
e_WriteLog('Creating GL window', TMsgType.Notify);
if not CreateGLWindow(PChar(Format('Doom 2D: Forever %s', [GAME_VERSION]))) then