summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1b91259)
raw | patch | inline | side by side (parent: 1b91259)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 19 Jun 2021 10:37:49 +0000 (13:37 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 29 Jun 2021 09:51:12 +0000 (12:51 +0300) |
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 268e281a029f8e05fefb378a13db5d7fd20b6117..b66ba3b6535bfe364524b3c3247bbcc6f1bc08ea 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
end;
{$ENDIF}
+ procedure ScreenResize (w, h: Integer);
+ begin
+ r_Render_Resize(w, h);
+ {$IFDEF ENABLE_HOLMES}
+ fuiScrWdt := w;
+ fuiScrHgt := h;
+ {$ENDIF}
+ g_Game_SetupScreenSize;
+ {$IFNDEF ANDROID}
+ (* This will fix menu reset on keyboard showing *)
+ g_Menu_Reset;
+ {$ENDIF}
+ //g_Game_ClearLoading;
+ {$IFDEF ENABLE_HOLMES}
+ if assigned(oglInitCB) then oglInitCB;
+ {$ENDIF}
+ end;
+
procedure Startup;
begin
Randomize;
e_InitSoundSystem(NoSound);
sys_Init;
sys_CharPress := @CharPress; (* install hook *)
+ sys_ScreenResize := @ScreenResize; (* install hook *)
g_Options_SetDefault;
g_Options_SetDefaultVideo;
g_Console_Initialize;
index 9f8b754e4e494424548e5685c57fc6df9b147598..668fb901f4e850dcd843a09ce3342daaecdccda2 100644 (file)
procedure r_Render_Initialize;
procedure r_Render_Finalize;
+ procedure r_Render_Resize (w, h: Integer);
implementation
- uses SysUtils, Classes, g_system, g_game, g_options, r_window, r_graphics, r_console, r_playermodel;
+ uses SysUtils, Classes, e_log, g_system, g_game, g_options, r_window, r_graphics, r_console, r_playermodel;
procedure r_Render_Initialize;
begin
e_ReleaseEngine
end;
+ procedure r_Render_Resize (w, h: Integer);
+ begin
+ gWinSizeX := w;
+ gWinSizeY := h;
+ gRC_Width := w;
+ gRC_Height := h;
+ if glRenderToFBO then
+ begin
+ // store real window size in gWinSize, downscale resolution now
+ w := round(w / r_pixel_scale);
+ h := round(h / r_pixel_scale);
+ if not e_ResizeFramebuffer(w, h) then
+ begin
+ e_LogWriteln('GL: could not create framebuffer, falling back to --no-fbo');
+ glRenderToFBO := False;
+ w := gWinSizeX;
+ h := gWinSizeY;
+ end;
+ end;
+ gScreenWidth := w;
+ gScreenHeight := h;
+ e_ResizeWindow(w, h);
+ e_InitGL
+ end;
+
end.
index c191583fa77f2a5c77a0cfa2c9e2204ccbe576bc..d61dd32687131875cb94971afe76b3e6380e3425 100644 (file)
var (* hooks *)
sys_CharPress: procedure (ch: AnsiChar) = nil;
+ sys_ScreenResize: procedure (w, h: Integer) = nil;
implementation
{$ENDIF}
end;
- procedure UpdateSize (w, h: Integer);
- begin
- gWinSizeX := w;
- gWinSizeY := h;
- gRC_Width := w;
- gRC_Height := h;
- if glRenderToFBO then
- begin
- // store real window size in gWinSize, downscale resolution now
- w := round(w / r_pixel_scale);
- h := round(h / r_pixel_scale);
- if not e_ResizeFramebuffer(w, h) then
- begin
- e_LogWriteln('GL: could not create framebuffer, falling back to --no-fbo');
- glRenderToFBO := False;
- w := gWinSizeX;
- h := gWinSizeY;
- end;
- end;
- gScreenWidth := w;
- gScreenHeight := h;
- {$IFDEF ENABLE_HOLMES}
- fuiScrWdt := w;
- fuiScrHgt := h;
- {$ENDIF}
- e_ResizeWindow(w, h);
- e_InitGL;
- g_Game_SetupScreenSize;
- g_Menu_Reset;
- g_Game_ClearLoading;
- end;
-
function GetTitle (): PChar;
var info: AnsiString;
begin
SDL_WM_SetCaption(GetTitle(), nil);
gFullScreen := fullscreen;
gRC_FullScreen := fullscreen;
- UpdateSize(w, h);
+ if @sys_ScreenResize <> nil then
+ sys_ScreenResize(w, h);
result := True
end
end
begin
if g_dbg_input then
e_LogWritefln('Input Debug: SDL_VIDEORESIZE %s %s', [ev.w, ev.h]);
- if modeResize = 1 then
- UpdateSize(ev.w, ev.h)
+ if (modeResize = 1) and (@sys_ScreenResize <> nil) then
+ sys_ScreenResize(ev.w, ev.h);
else if modeResize > 1 then
InitWindow(ev.w, ev.h, gBPP, gFullscreen)
end;
index ff52b1dc98ba163f82a82ed391c6564462da24bd..5468afb36645a728039d44582cae616022672cf9 100644 (file)
var (* hooks *)
sys_CharPress: procedure (ch: AnsiChar) = nil;
+ sys_ScreenResize: procedure (w, h: Integer) = nil;
implementation
{$ENDIF}
end;
- procedure UpdateSize (w, h: Integer);
- begin
- gWinSizeX := w;
- gWinSizeY := h;
- gRC_Width := w;
- gRC_Height := h;
- if glRenderToFBO then
- begin
- // store real window size in gWinSize, downscale resolution now
- w := round(w / r_pixel_scale);
- h := round(h / r_pixel_scale);
- if not e_ResizeFramebuffer(w, h) then
- begin
- e_LogWriteln('GL: could not create framebuffer, falling back to --no-fbo');
- glRenderToFBO := False;
- w := gWinSizeX;
- h := gWinSizeY;
- end;
- end;
- gScreenWidth := w;
- gScreenHeight := h;
- {$IFDEF ENABLE_HOLMES}
- fuiScrWdt := w;
- fuiScrHgt := h;
- {$ENDIF}
- e_ResizeWindow(w, h);
- e_InitGL;
- g_Game_SetupScreenSize;
- {$IFNDEF ANDROID}
- (* This will fix menu reset on keyboard showing *)
- g_Menu_Reset;
- {$ENDIF}
- g_Game_ClearLoading;
- {$IFDEF ENABLE_HOLMES}
- if assigned(oglInitCB) then oglInitCB;
- {$ENDIF}
- end;
-
function GetTitle (): PChar;
var info: AnsiString;
begin
gWinMaximized := maximized;
gRC_FullScreen := fullscreen;
gRC_Maximized := maximized;
- UpdateSize(w, h);
+ if @sys_ScreenResize <> nil then
+ sys_ScreenResize(w, h);
result := true
end
else
gWinMaximized := maximized;
gRC_FullScreen := fullscreen;
gRC_Maximized := maximized;
- UpdateSize(w, h);
+ if @sys_ScreenResize <> nil then
+ sys_ScreenResize(w, h);
result := true
end
end;
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_RESIZED:
+ if @sys_ScreenResize <> nil then
+ sys_ScreenResize(ev.data1, ev.data2);
SDL_WINDOWEVENT_EXPOSED: sys_Repaint;
SDL_WINDOWEVENT_CLOSE: result := true;
SDL_WINDOWEVENT_MOVED:
index 4e4f42377e3da2e59abb09b1967ce97add6ad01f..9d14f24fcaa45a3740b1f74a551b418bcd236c62 100644 (file)
var (* hooks *)
sys_CharPress: procedure (ch: AnsiChar) = nil;
+ sys_ScreenResize: procedure (w, h: Integer) = nil;
implementation