From d2985e29b8635b82e83e4ce5b84de3846cd322ab Mon Sep 17 00:00:00 2001 From: LupertEverett <86886753+LupertEverett@users.noreply.github.com> Date: Sat, 28 Dec 2024 18:48:36 +0300 Subject: [PATCH] Engine: Implement "togglefullscreen" command --- SurrealEngine/Engine.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SurrealEngine/Engine.cpp b/SurrealEngine/Engine.cpp index 231689cd..93d8883c 100644 --- a/SurrealEngine/Engine.cpp +++ b/SurrealEngine/Engine.cpp @@ -820,6 +820,22 @@ std::string Engine::ConsoleCommand(UObject* context, const std::string& commandl { window->SetResolution(args[1]); } + else if (command == "togglefullscreen") + { + bool isFullscreen = window->IsFullscreen(); + + // Get the resolutions to SWITCH TO + int width = isFullscreen ? client->WindowedViewportX : client->FullscreenViewportX; + int height = isFullscreen ? client->WindowedViewportY : client->FullscreenViewportY; + + Size resolution; + resolution.width = width; + resolution.height = height; + + window->ToggleWindowFullscreen(resolution); + + return {}; + } else { if (!ExecCommand(args))