Slate.SoftwareCursorScale
Slate.SoftwareCursorScale
#Overview
name: Slate.SoftwareCursorScale
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Scale factor applied to the software cursor. Requires the cursor widget to be scale-aware.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Slate.SoftwareCursorScale is to provide a scale factor for the software cursor in Unreal Engine’s Slate UI framework. This setting variable is used to adjust the size of the software cursor, which is particularly useful when the default cursor size needs to be modified for better visibility or interaction.
This setting variable is primarily used in the Slate module of Unreal Engine, specifically within the application framework for Slate users. Based on the callsites, it’s evident that this variable is utilized in the FSlateUser class, which is responsible for managing user input and cursor rendering in Slate applications.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1.0f and can be modified at runtime using console commands or through code.
The associated variable SoftwareCursorScale directly interacts with Slate.SoftwareCursorScale. They share the same value, with SoftwareCursorScale being the actual float variable used in the code, while Slate.SoftwareCursorScale is the console variable name used for external access and modification.
Developers must be aware of the following when using this variable:
- The cursor widget must be scale-aware for this setting to take effect.
- Changing this value will affect the size of the software cursor across the entire application.
- This scale is applied in addition to any window root scale, so it may interact with other scaling factors in the UI.
Best practices when using this variable include:
- Use it sparingly and only when necessary to adjust cursor size.
- Test the cursor visibility and usability across different resolutions and display settings when modifying this value.
- Consider accessibility implications when changing the cursor scale.
- Document any non-default values used in the project for easier maintenance.
Regarding the associated variable SoftwareCursorScale: This is the actual float variable used in the code to store and apply the cursor scale. It’s initialized with a default value of 1.0f and is directly linked to the Slate.SoftwareCursorScale console variable. The SoftwareCursorScale variable is used in the FSlateUser::DrawCursor function to scale the cursor widget’s desired size and position. Developers should be aware that modifying this variable directly in code will have the same effect as changing the console variable, and it will impact the cursor size across the entire Slate application.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:40
Scope: file
Source code excerpt:
static float SoftwareCursorScale = 1.0f;
FAutoConsoleVariableRef CVarSoftwareCursorScale(
TEXT("Slate.SoftwareCursorScale"),
SoftwareCursorScale,
TEXT("Scale factor applied to the software cursor. Requires the cursor widget to be scale-aware."));
static float TooltipSummonDelay = 0.15f;
FAutoConsoleVariableRef CVarTooltipSummonDelay(
TEXT("Slate.TooltipSummonDelay"),
#Associated Variable and Callsites
This variable is associated with another variable named SoftwareCursorScale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:38
Scope: file
Source code excerpt:
TEXT(""));
static float SoftwareCursorScale = 1.0f;
FAutoConsoleVariableRef CVarSoftwareCursorScale(
TEXT("Slate.SoftwareCursorScale"),
SoftwareCursorScale,
TEXT("Scale factor applied to the software cursor. Requires the cursor widget to be scale-aware."));
static float TooltipSummonDelay = 0.15f;
FAutoConsoleVariableRef CVarTooltipSummonDelay(
TEXT("Slate.TooltipSummonDelay"),
TooltipSummonDelay,
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:639
Scope (from outer to inner):
file
function void FSlateUser::DrawCursor
Source code excerpt:
FVector2f CursorInScreen = GetCursorPosition();
FVector2f CursorPosInWindowSpace = WindowToDraw->GetWindowGeometryInScreen().AbsoluteToLocal(CursorInScreen) * WindowRootScale;
CursorPosInWindowSpace += (CursorWidget->GetDesiredSize() * SoftwareCursorScale * -0.5);
const FGeometry CursorGeometry = FGeometry::MakeRoot(CursorWidget->GetDesiredSize() * SoftwareCursorScale, FSlateLayoutTransform(CursorPosInWindowSpace));
CursorWidget->Paint(
FPaintArgs(&WindowToDraw.Get(), WindowToDraw->GetHittestGrid(), WindowToDraw->GetPositionInScreen(), SlateApp.GetCurrentTime(), SlateApp.GetDeltaTime()),
CursorGeometry, WindowToDraw->GetClippingRectangleInWindow(),
WindowElementList,
++MaxLayerId,