summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1f93eba)
raw | patch | inline | side by side (parent: 1f93eba)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 6 Feb 2018 21:39:45 +0000 (23:39 +0200) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 6 Feb 2018 21:41:09 +0000 (23:41 +0200) |
src/game/g_options.pas | patch | blob | history | |
src/game/g_window.pas | patch | blob | history |
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index c43da69ec21d1e7cc87a36027c559a288d225e37..b92d2578471871aa66962d67a503ee04a330928b 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
sW := gScreenWidth;
sH := gScreenHeight;
end;
+ e_LogWritefln(' (ws=%dx%d) (ss=%dx%d)', [gWinSizeX, gWinSizeY, gScreenWidth, gScreenHeight]);
config.WriteInt('Video', 'ScreenWidth', sW);
config.WriteInt('Video', 'ScreenHeight', sH);
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index a40441b492a7d6fee0db0eb2a6c206aafb031e3f..ab8df098b0be9534e5cec7279e0aa9533c9d0539 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
e_WriteLog('Setting display mode...', TMsgType.Notify);
- wFlags := SDL_WINDOW_OPENGL; // or SDL_WINDOW_RESIZABLE;
- if gFullscreen then wFlags := wFlags or SDL_WINDOW_FULLSCREEN or SDL_WINDOW_BORDERLESS else wFlags := wFlags or SDL_WINDOW_RESIZABLE;
- //if gWinMaximized then wFlags := wFlags or SDL_WINDOW_MAXIMIZED;
+ wFlags := SDL_WINDOW_OPENGL {or SDL_WINDOW_RESIZABLE};
+ if gFullscreen then wFlags := wFlags or SDL_WINDOW_FULLSCREEN else wFlags := wFlags or SDL_WINDOW_RESIZABLE;
+ if (not gFullscreen) and gWinMaximized then wFlags := wFlags or SDL_WINDOW_MAXIMIZED;
if gFullscreen then
begin
end;
end;
- KillGLWindow(preserveGL);
-
- h_Wnd := SDL_CreateWindow(PChar(wTitle), gWinRealPosX, gWinRealPosY, gScreenWidth, gScreenHeight, wFlags);
- if (h_Wnd = nil) then exit;
+ (*if (preserveGL) and (h_Wnd <> nil) {and (gFullscreen)} then
+ begin
+ e_WriteLog('SDL: going fullscreen...', TMsgType.Notify);
+ //SDL_SetWindowMaximumSize(h_Wnd, gScreenWidth, gScreenHeight);
+ SDL_SetWindowDisplayMode(h_Wnd, @cmode);
+ SDL_SetWindowSize(h_Wnd, gScreenWidth, gScreenHeight);
+ if (gFullscreen) then
+ begin
+ SDL_SetWindowFullscreen(h_Wnd, SDL_WINDOW_FULLSCREEN);
+ end
+ else
+ begin
+ SDL_SetWindowFullscreen(h_Wnd, 0);
+ end;
+ end
+ else*)
+ begin
+ KillGLWindow(preserveGL);
+ h_Wnd := SDL_CreateWindow(PChar(wTitle), gWinRealPosX, gWinRealPosY, gScreenWidth, gScreenHeight, wFlags);
+ if (h_Wnd = nil) then exit;
+ end;
SDL_GL_MakeCurrent(h_Wnd, h_GL);
SDL_ShowCursor(SDL_DISABLE);
procedure ChangeWindowSize ();
begin
+ e_LogWritefln(' ChangeWindowSize: (ws=%dx%d) (ss=%dx%d)', [gWinSizeX, gWinSizeY, gScreenWidth, gScreenHeight]);
gWinSizeX := gScreenWidth;
gWinSizeY := gScreenHeight;
{$IF not DEFINED(HEADLESS)}
SDL_WINDOWEVENT_RESIZED:
begin
- gScreenWidth := ev.data1;
- gScreenHeight := ev.data2;
+ e_LogWritefln('Resize: (os=%dx%d) (ns=%dx%d)', [gScreenWidth, gScreenHeight, Integer(ev.data1), Integer(ev.data2)]);
+ {if (gFullscreen) then
+ begin
+ e_LogWriteln(' fullscreen fix applied.');
+ if (gScreenWidth <> ev.data1) or (gScreenHeight <> ev.data2) then
+ begin
+ SDL_SetWindowSize(h_Wnd, gScreenWidth, gScreenHeight);
+ end;
+ end
+ else}
+ begin
+ gScreenWidth := ev.data1;
+ gScreenHeight := ev.data2;
+ end;
ChangeWindowSize();
SwapBuffers();
if g_debug_WinMsgs then
wMinimized := false;
wActivate := true;
end;
- if not gWinMaximized then
+ if (not gWinMaximized) and (not gFullscreen) then
begin
gWinMaximized := true;
if g_debug_WinMsgs then
wMinimized := false;
wActivate := true;
end;
- if gWinMaximized then gWinMaximized := false;
+ gWinMaximized := false;
if g_debug_WinMsgs then
begin
g_Console_Add('Now restored');