Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Update SetResolution method #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions Source/UETorch/Private/UETorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,15 +954,18 @@ extern "C" bool AddForce(AActor* object, float x, float y, float z) {
return true;
}

// implemented from https://wiki.unrealengine.com/Game_User_Settings
extern "C" bool SetResolution(int x, int y) {
if(GEngine && GEngine->GameViewport && GEngine->GameViewport->ViewportFrame) {
int32 WindowModeInt = GSystemResolution.WindowMode;
EWindowMode::Type WindowMode = EWindowMode::ConvertIntToWindowMode(WindowModeInt);
GEngine->GameViewport->ViewportFrame->ResizeFrame(x, y, WindowMode);
return true;
} else {
return false;
}
if(! GEngine)
return false;

UGameUserSettings* Settings = GEngine->GameUserSettings;
if(! Settings)
return false;

Settings->RequestResolutionChange(x, y, EWindowMode::Type::Windowed, false);
Settings->ConfirmVideoMode();
return true;
}

extern "C" void ExecuteConsoleCommand(UObject* _this, char* command) {
Expand Down