Slate.Transform.FullscreenMouseInput
Slate.Transform.FullscreenMouseInput
#Overview
name: Slate.Transform.FullscreenMouseInput
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set true to transform mouse input to account for viewport stretching at fullscreen resolutions not natively supported by the monitor.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Slate.Transform.FullscreenMouseInput is to control whether mouse input should be transformed to account for viewport stretching in fullscreen resolutions that are not natively supported by the monitor.
This setting variable is primarily used in the Slate subsystem of Unreal Engine 5, specifically within the SlateApplication module. It affects how mouse input is processed and interpreted in fullscreen mode.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through the console. By default, it is set to true.
The associated variable TransformFullscreenMouseInput directly interacts with Slate.Transform.FullscreenMouseInput. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable only affects fullscreen mode and is not applied in windowed mode or when running in the editor. It’s specifically designed to handle situations where the game’s fullscreen resolution doesn’t match the monitor’s native resolution.
Best practices when using this variable include:
- Leaving it enabled (true) for most cases to ensure proper mouse input handling in fullscreen mode.
- Consider disabling it if you’re developing a game that requires precise 1:1 mouse input and you’re certain that your fullscreen resolution will always match the monitor’s native resolution.
- Test your game thoroughly with different monitor resolutions and fullscreen settings to ensure proper mouse input behavior.
Regarding the associated variable TransformFullscreenMouseInput:
The purpose of TransformFullscreenMouseInput is the same as Slate.Transform.FullscreenMouseInput. It’s the actual boolean variable that stores the setting’s value.
This variable is used directly in the Slate subsystem, particularly in the FSlateApplication class. It’s referenced in functions like LocateWidgetInWindow, GetTransformFullscreenMouseInput, and TransformPointerEvent.
The value of TransformFullscreenMouseInput is set by the FAutoConsoleVariableRef associated with Slate.Transform.FullscreenMouseInput.
TransformFullscreenMouseInput interacts closely with various mouse input processing functions in the SlateApplication.
Developers should be aware that this variable affects how mouse coordinates are transformed when dealing with fullscreen windows. It’s crucial for maintaining accurate mouse input when the game resolution doesn’t match the monitor’s native resolution.
Best practices for TransformFullscreenMouseInput are the same as those for Slate.Transform.FullscreenMouseInput, as they are essentially two representations of the same setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:575
Scope: file
Source code excerpt:
static bool TransformFullscreenMouseInput = true;
FAutoConsoleVariableRef CVarSlateTransformFullscreenMouseInput(
TEXT("Slate.Transform.FullscreenMouseInput"),
TransformFullscreenMouseInput,
TEXT("Set true to transform mouse input to account for viewport stretching at fullscreen resolutions not natively supported by the monitor.")
);
#if PLATFORM_UI_NEEDS_TOOLTIPS
static bool bEnableTooltips = true;
#Associated Variable and Callsites
This variable is associated with another variable named TransformFullscreenMouseInput
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:573
Scope: file
Source code excerpt:
);
static bool TransformFullscreenMouseInput = true;
FAutoConsoleVariableRef CVarSlateTransformFullscreenMouseInput(
TEXT("Slate.Transform.FullscreenMouseInput"),
TransformFullscreenMouseInput,
TEXT("Set true to transform mouse input to account for viewport stretching at fullscreen resolutions not natively supported by the monitor.")
);
#if PLATFORM_UI_NEEDS_TOOLTIPS
static bool bEnableTooltips = true;
#else
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:1805
Scope (from outer to inner):
file
function FWidgetPath FSlateApplication::LocateWidgetInWindow
Source code excerpt:
FVector2f CursorPosition = ScreenspaceMouseCoordinate;
if (TransformFullscreenMouseInput && !GIsEditor && Window->GetWindowMode() == EWindowMode::Fullscreen)
{
// Screen space mapping scales everything. When window resolution doesn't match platform resolution,
// this causes offset cursor hit-tests in fullscreen. Correct in slate since we are first window-aware slate processor.
FVector2f WindowSize = Window->GetSizeInScreen();
FVector2f DisplaySize = { (float)CachedDisplayMetrics.PrimaryDisplayWidth, (float)CachedDisplayMetrics.PrimaryDisplayHeight };
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:2571
Scope (from outer to inner):
file
function bool FSlateApplication::GetTransformFullscreenMouseInput
Source code excerpt:
bool FSlateApplication::GetTransformFullscreenMouseInput() const
{
return TransformFullscreenMouseInput;
}
#if WITH_SLATE_DEBUGGING
void FSlateApplication::TryDumpNavigationConfig(TSharedPtr<FNavigationConfig> InNavigationConfig) const
{
if (GSlateTraceNavigationConfig && InNavigationConfig)
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:4459
Scope (from outer to inner):
file
function FPointerEvent FSlateApplication::TransformPointerEvent
Source code excerpt:
if (Window)
{
if (TransformFullscreenMouseInput && !GIsEditor && Window->GetWindowMode() == EWindowMode::Fullscreen)
{
// Screen space mapping scales everything. When window resolution doesn't match platform resolution,
// this causes offset cursor hit-tests in fullscreen. Correct in slate since we are first window-aware slate processor.
FVector2f WindowSize = Window->GetSizeInScreen();
FVector2f DisplaySize = { (float)CachedDisplayMetrics.PrimaryDisplayWidth, (float)CachedDisplayMetrics.PrimaryDisplayHeight };