Skip to content

Commit

Permalink
Engine: Implement "togglefullscreen" command
Browse files Browse the repository at this point in the history
  • Loading branch information
LupertEverett authored and dpjudas committed Dec 28, 2024
1 parent 05bbdde commit d2985e2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions SurrealEngine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit d2985e2

Please sign in to comment.