diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index f88f93a1f..ac1c66eab 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -1926,6 +1926,11 @@ void GameInterface::FreeGameData() ShutDown(); } +void GameInterface::UpdateScreenSize() +{ + viewResizeView(gViewSize); +} + ::GameInterface* CreateInterface() { diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index b62d90f4e..9794cd5c2 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -84,6 +84,7 @@ struct GameInterface : ::GameInterface { void faketimerhandler() override; int app_main() override; + void UpdateScreenSize() override; void FreeGameData() override; bool validate_hud(int) override; void set_hud_layout(int size) override; diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index 2fda1fa88..04386c3e2 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -105,6 +105,7 @@ struct GameInterface virtual ~GameInterface() {} virtual void faketimerhandler() {} // This is a remnant of older versions, but Blood backend has not updated yet. virtual int app_main() = 0; + virtual void UpdateScreenSize() {} virtual void FreeGameData() {} virtual bool validate_hud(int) = 0; virtual void set_hud_layout(int size) = 0; diff --git a/source/common/inputstate.cpp b/source/common/inputstate.cpp index 791899f39..044776da8 100644 --- a/source/common/inputstate.cpp +++ b/source/common/inputstate.cpp @@ -67,6 +67,22 @@ void I_StartTic(); int32_t handleevents(void) { + // fullscreen toggle has been requested + if (setmodeneeded) + { + setmodeneeded = false; + screen->ToggleFullscreen(fullscreen); + V_OutputResized(screen->GetWidth(), screen->GetHeight()); + } + + // change the view size if needed + if (setsizeneeded) + { + videoSetGameMode(vid_fullscreen, SCREENWIDTH, SCREENHEIGHT, 32, 1); + if (gi) gi->UpdateScreenSize(); + setsizeneeded = false; + } + timerUpdateClock(); // The mouse wheel is not a real key so in order to be "pressed" it may only be cleared at the end of the tic (or the start of the next.) diff --git a/source/common/rendering/v_video.cpp b/source/common/rendering/v_video.cpp index c323fd1af..1986b85ad 100644 --- a/source/common/rendering/v_video.cpp +++ b/source/common/rendering/v_video.cpp @@ -515,7 +515,7 @@ void V_UpdateModeSize (int width, int height) void V_OutputResized (int width, int height) { V_UpdateModeSize(width, height); -// setsizeneeded = true; + setsizeneeded = true; C_NewModeAdjust(); } diff --git a/source/common/rendering/v_video.h b/source/common/rendering/v_video.h index d4e1158e4..0da33a170 100644 --- a/source/common/rendering/v_video.h +++ b/source/common/rendering/v_video.h @@ -434,6 +434,8 @@ void ScaleWithAspect(int &w, int &h, int Width, int Height); int GetUIScale(int altval); int GetConScale(int altval); +extern bool setsizeneeded, setmodeneeded; + EXTERN_CVAR(Int, uiscale); EXTERN_CVAR(Int, con_scaletext); EXTERN_CVAR(Int, con_scale); diff --git a/source/duke3d/src/duke3d.h b/source/duke3d/src/duke3d.h index 241fce099..18e49b7bd 100644 --- a/source/duke3d/src/duke3d.h +++ b/source/duke3d/src/duke3d.h @@ -143,6 +143,7 @@ static inline int32_t G_DefaultActorHealth(int spriteNum) struct GameInterface : ::GameInterface { int app_main() override; + void UpdateScreenSize() override; void FreeGameData() override; bool validate_hud(int) override; void set_hud_layout(int size) override; diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index e91e42e98..f31e0eaa9 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -6441,6 +6441,11 @@ void GameInterface::FreeGameData() G_Cleanup(); } +void GameInterface::UpdateScreenSize() +{ + G_UpdateScreenArea(); +} + ::GameInterface* CreateInterface() { return new GameInterface; diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 5f1eea39c..cb741207a 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -3286,6 +3286,11 @@ bool GameInterface::CanSave() return !bRecord && !bPlayback && !bPause && !bInDemo && nTotalPlayers == 1; } +void GameInterface::UpdateScreenSize() +{ + Powerslave::UpdateScreenSize(); +} + ::GameInterface* CreateInterface() { diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index eb637238b..94cf28fe0 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -273,6 +273,7 @@ void G_DoAutoload(const char* dirname); struct GameInterface : ::GameInterface { int app_main() override; + void UpdateScreenSize() override; bool validate_hud(int) override { return true; } void set_hud_layout(int size) override {} void set_hud_scale(int size) override {} diff --git a/source/rr/src/duke3d.h b/source/rr/src/duke3d.h index afd4db0cd..9b33fa3f7 100644 --- a/source/rr/src/duke3d.h +++ b/source/rr/src/duke3d.h @@ -146,6 +146,7 @@ static inline int32_t G_DefaultActorHealth(int spriteNum) struct GameInterface : ::GameInterface { int app_main() override; + void UpdateScreenSize() override; void FreeGameData() override; bool validate_hud(int) override; void set_hud_layout(int size) override; diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 1001b35fc..ed8cfb262 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7888,6 +7888,11 @@ void GameInterface::FreeGameData() G_Cleanup(); } +void GameInterface::UpdateScreenSize() +{ + G_UpdateScreenArea(); +} + ::GameInterface* CreateInterface() { return new GameInterface; diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 06d21cedb..138e118c6 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -3958,6 +3958,10 @@ void GameInterface::FreeGameData() TerminateLevel(); } +void GameInterface::UpdateScreenSize() +{ + SetupAspectRatio(); +} #if 0 // the message input needs to be moved out of the game code! diff --git a/source/sw/src/game.h b/source/sw/src/game.h index b6e480834..adb31e41d 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2430,6 +2430,7 @@ void LoadSaveMsg(const char *msg); struct GameInterface : ::GameInterface { int app_main() override; + void UpdateScreenSize() override; void FreeGameData() override; bool validate_hud(int) override; void set_hud_layout(int size) override;