summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9fff77c)
raw | patch | inline | side by side (parent: 9fff77c)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 13 Nov 2019 12:40:54 +0000 (15:40 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Wed, 13 Nov 2019 12:40:54 +0000 (15:40 +0300) |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 27dcb909f4f11dd463aad1ce0aae631fbc1233a9..054879203c5008a45ac9b60dbd9f17b4b869e409 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
procedure g_Game_ChangeResolution(newWidth, newHeight: Word; nowFull, nowMax: Boolean);
begin
- sys_SetDisplayMode(newWidth, newHeight, gBPP, nowFull);
+ sys_SetDisplayMode(newWidth, newHeight, gBPP, nowFull, nowMax);
end;
procedure g_Game_AddPlayer(Team: Byte = TEAM_NONE);
diff --git a/src/game/g_main.pas b/src/game/g_main.pas
index def9f2914d20b342539c8021c605dc93e39c353f..c290df5e6b2176f743ae93748f919b73bd14add9 100644 (file)
--- a/src/game/g_main.pas
+++ b/src/game/g_main.pas
if e_FindResource(ConfigDirs, s) = true then
g_Options_Read(s);
g_Console_SysInit;
- if sys_SetDisplayMode(gScreenWidth, gScreenHeight, gBPP, gFullScreen) = False then
+ if sys_SetDisplayMode(gRC_Width, gRC_Height, gBPP, gRC_FullScreen, gRC_Maximized) = False then
raise Exception.Create('Failed to set videomode on startup.');
e_WriteLog(gLanguage, TMsgType.Notify);
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index 078ced29cfaaf9b0a86ac020981b3366f62c5bba..d523da8c511b83be4d6d6bc68af001e49598654d 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
gRC_Width := gScreenWidth;
gRC_Height := gScreenHeight;
gRC_FullScreen := gFullScreen;
+ gRC_Maximized := gWinMaximized;
e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight));
g_Console_ResetBinds;
end;
gRC_Width := gScreenWidth;
gRC_Height := gScreenHeight;
gRC_FullScreen := gFullScreen;
+ gRC_Maximized := gWinMaximized;
e_LogWriteLn('g_Options_SetDefaultVideo: w = ' + IntToStr(gScreenWidth) + ' h = ' + IntToStr(gScreenHeight));
g_Console_ResetBinds;
end;
gRC_Width := Max(1, gRC_Width);
gRC_Height := Max(1, gRC_Height);
gBPP := Max(1, gBPP);
- if sys_SetDisplayMode(gRC_Width, gRC_Height, gBPP, gRC_FullScreen) = True then
+ if sys_SetDisplayMode(gRC_Width, gRC_Height, gBPP, gRC_FullScreen, gRC_Maximized) = True then
e_LogWriteln('resolution changed')
else
e_LogWriteln('resolution not changed')
index 01467205ceaf1285f382cbf7ef4be336f6f68289..00770890eb99be483c7e1f2b6cfe3e7cad38efaf 100644 (file)
(* --- Graphics --- *)
function sys_GetDisplayModes (bpp: Integer): SSArray;
- function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen: Boolean): Boolean;
+ function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen, maximized: Boolean): Boolean;
procedure sys_EnableVSync (yes: Boolean);
procedure sys_Repaint;
gWinSizeY := h;
gScreenWidth := w;
gScreenHeight := h;
+ gRC_Width := w;
+ gRC_Height := h;
{$IFDEF ENABLE_HOLMES}
fuiScrWdt := w;
fuiScrHgt := h;
var flags: Uint32;
begin
e_LogWritefln('InitWindow %s %s %s %s', [w, h, bpp, fullScreen]);
- result := False;
+ result := false;
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
nogl_Init;
{$ENDIF}
SDL_WM_SetCaption(GetTitle(), nil);
+ gFullScreen := fullscreen;
+ gRC_FullScreen := fullscreen;
UpdateSize(w, h);
result := True
end
end
end;
- function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen: Boolean): Boolean;
+ function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen, maximized: Boolean): Boolean;
begin
result := InitWindow(w, h, bpp, fullscreen)
end;
index 7899e9cfac8e602b427f5c21049bcdf72e845e1b..511e06200dd020c08d950a998c3025cc97c08b05 100644 (file)
(* --- Graphics --- *)
function sys_GetDisplayModes (bpp: Integer): SSArray;
- function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen: Boolean): Boolean;
+ function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen, maximized: Boolean): Boolean;
procedure sys_EnableVSync (yes: Boolean);
procedure sys_Repaint;
gWinSizeY := h;
gScreenWidth := w;
gScreenHeight := h;
+ gRC_Width := w;
+ gRC_Height := h;
{$IFDEF ENABLE_HOLMES}
fuiScrWdt := w;
fuiScrHgt := h;
result := PChar(Format(GameTitle, [info]))
end;
- function InitWindow (w, h, bpp: Integer; fullScreen: Boolean): Boolean;
+ function InitWindow (w, h, bpp: Integer; fullScreen, maximized: Boolean): Boolean;
var flags: UInt32; x, y: Integer;
begin
// note: on window close make: if assigned(oglDeinitCB) then oglDeinitCB;
{$ENDIF}
flags := SDL_WINDOW_OPENGL or SDL_WINDOW_RESIZABLE;
if fullScreen then flags := flags or SDL_WINDOW_FULLSCREEN;
+ if maximized then flags := flags or SDL_WINDOW_MAXIMIZED;
x := SDL_WINDOWPOS_CENTERED;
y := SDL_WINDOWPOS_CENTERED;
window := SDL_CreateWindow(GetTitle(), x, y, w, h, flags);
{$IFDEF NOGL_INIT}
nogl_Init;
{$ENDIF}
+ gFullScreen := fullscreen;
+ gWinMaximized := maximized;
+ gRC_FullScreen := fullscreen;
+ gRC_Maximized := maximized;
UpdateSize(w, h);
result := true
end
end
else
begin
- if fullScreen then flags := SDL_WINDOW_FULLSCREEN else flags := 0;
SDL_SetWindowSize(window, w, h);
+ if maximized then
+ SDL_MaximizeWindow(window);
+ if fullScreen then flags := SDL_WINDOW_FULLSCREEN else flags := 0;
SDL_SetWindowFullscreen(window, flags);
+ gFullScreen := fullscreen;
+ gWinMaximized := maximized;
+ gRC_FullScreen := fullscreen;
+ gRC_Maximized := maximized;
UpdateSize(w, h);
result := true
end
end
end;
- function sys_SetDisplayMode (w, h, bpp: Integer; fullScreen: Boolean): Boolean;
+ function sys_SetDisplayMode (w, h, bpp: Integer; fullScreen, maximized: Boolean): Boolean;
begin
- result := InitWindow(w, h, bpp, fullScreen)
+ result := InitWindow(w, h, bpp, fullScreen, maximized)
end;
(* --------- Joystick --------- *)
function HandleWindow (var ev: TSDL_WindowEvent): Boolean;
begin
result := false;
+ if g_dbg_input then
+ e_LogWritefln('Window Event: event = %s, data1 = %s, data2 = %s', [ev.event, ev.data1, ev.data2]);
case ev.event of
SDL_WINDOWEVENT_RESIZED: UpdateSize(ev.data1, ev.data2);
SDL_WINDOWEVENT_EXPOSED: sys_Repaint;
end;
SDL_WINDOWEVENT_FOCUS_GAINED, SDL_WINDOWEVENT_MAXIMIZED, SDL_WINDOWEVENT_RESTORED:
begin
+ if ev.event = SDL_WINDOWEVENT_MAXIMIZED then
+ gRC_Maximized := true
+ else if ev.event = SDL_WINDOWEVENT_RESTORED then
+ gRC_Maximized := false;
e_MuteChannels(false);
{$IFDEF ENABLE_HOLMES}
if assigned(winFocusCB) then winFocusCB;
index abae19018304c4f3ea470920d987319b0212fcab..c3b4b23e0ee43fbacdec4756a62f4bdd782c4dcd 100644 (file)
(* --- Graphics --- *)
function sys_GetDisplayModes (bpp: Integer): SSArray;
- function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen: Boolean): Boolean;
+ function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen, maximized: Boolean): Boolean;
procedure sys_EnableVSync (yes: Boolean);
procedure sys_Repaint;
result := nil
end;
- function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen: Boolean): Boolean;
+ function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen, maximized: Boolean): Boolean;
begin
result := true
end;