summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a5e92d2)
raw | patch | inline | side by side (parent: a5e92d2)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 19 Jun 2021 10:37:49 +0000 (13:37 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 07:47:53 +0000 (10:47 +0300) |
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index d1fbc06443004070580798c0383ac96451e82199..6022ee6d9c7a929f6afe6adcf615a4496959265c 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
end;
end;
+ 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;
InitSound;
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 99b338cdc92f3d610c22a7d555c46c75f3070854..bb8c66ae3e28a1a1ffa8a68d642da52ac0ad4f6c 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 GetDriver (): AnsiString;
var buf: array [0..31] of AnsiChar;
begin
SDL_WM_SetCaption(PChar(title), 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 bf44ceaaa23d956e52107e5a6c18c16ccc305625..5e91cc0f285e0dfbeb08bea4a3e2e4227bbc6f18 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 (): AnsiString;
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