Skip to content

Screen size, cursor and players

Use this page to know how big a CSS px is on a given screen, what mouse cursor a document shows and who hides or shows it, and what changes with more than one local player.

CSS pixels and screen pixels

A px in an .rcss file is multiplied by the UE DPI scale of the game viewport before layout, so it is not one screen pixel in general. dp is multiplied the same way. Layout runs in screen pixels, in the content rect of the viewport (below).

The scale is the one UMG, Unreal's own widget UI, uses. It comes from Project Settings > Engine > User Interface > DPI Scaling: the DPI Curve and the DPI Scale Rule, times Application Scale. The plugin adds no Project Settings entry for it (Settings). With the default rule (shortest side) and curve:

Diagram: the default DPI curve; a 1920 by 1080 screen has scale 1.0 and a 3840 by 2160 screen has scale 2.0

Screen Shortest side Scale Room for a document
1920 x 1080 1080 1.0 1920 x 1080 px
3840 x 2160 2160 2.0 1920 x 1080 px
3440 x 1440 1440 1.33 1920 x 1080 px, a centred column

The curve is linear between its keys, so 1440p gives 1.33.

So a layout written for 1080p fills a 16:9 screen the same way at any resolution, at twice the pixels on 4K. The room is the content rect, not the whole screen: the platform's safe zone is removed from the screen, then the width is capped at MaxUIAspectRatio times the height, 16/9 by default, and the rect is centred. On the 3440 x 1440 screen the column is 2560 screen pixels wide, which is 1920 px; the document background still fills the whole screen.

Diagram: on a 3440 by 1440 screen the layout is a centred 1920 by 1080 px column and the document background fills the screen

Three settings change the size:

  • The aspect cap is not in Project Settings or Settings. A game changes it in C++ with UArcRmlUISettingsSubsystem::SetMaxUIAspectRatio on the game instance; 0 removes the limit. There is no Blueprint node for it.
  • To make every document larger or smaller, change the DPI Curve (or the rule) in that settings page, or set Application Scale.
  • For a UI size option in game, UArcRmlUISettingsSubsystem::SetUIScale (C++ only, on the game instance; no Blueprint node) sets Application Scale: it replaces the project value instead of multiplying it, and the project value comes back when the game instance ends.

When the window size or the scale changes, the open documents are laid out again.

Mouse cursor

The cursor property is inherited. Over an element that takes the pointer, the document asks Slate for the cursor named by the cursor value under the pointer:

cursor Cursor
pointer, hand Hand
text Text edit beam
move Cardinal cross
ew-resize, col-resize Resize left-right
ns-resize, row-resize Resize up-down
not-allowed Slashed circle
grab Grab hand
grabbing Closed grab hand
crosshair Crosshairs

Any other value, including default and auto, gives the default arrow. Over a part of the document that takes no pointer (empty space between elements) the document answers nothing, and the widgets below it and the game decide.

Who shows the cursor

The plugin never sets bShowMouseCursor. CommonUI, Unreal's UI input framework, shows or hides the cursor from the input-mode of the topmost active document of each player (only that document pushes its config):

Diagram: input-mode menu and all show the cursor, game hides it unless a text field is active, all with mouse-capture hides it unless data-mouse-release is shown

input-mode Cursor Mouse
menu Shown Not captured by the game. The cursor stays shown while the document leaves.
all Shown Not captured by the game.
all with mouse-capture true Hidden Captured by the game permanently.
all with mouse-capture true, while a text field of the document is active Shown Not captured by the game.
all with mouse-capture true, while an element with data-mouse-release is shown Shown Not captured by the game.
game (default) Hidden Captured by the game permanently.
game, while a text field of the document wants keyboard focus Shown Not captured by the game.

CommonUI shows the cursor in capture mode too when the console variable CommonUI.AlwaysShowCursor is on, the viewport fakes touch from the mouse, or its virtual pointer is shown. The virtual pointer is CommonUI's on-screen pointer, which a gamepad accept clicks at; ArcRml.VirtualPointer 1 shows it (Console), and CommonUI also needs CommonUI.EnableVirtualPointer, a console variable that is on by default.

A game that wants a cursor over its HUD, with no menu open, opens a menu or all document or sets CommonUI.AlwaysShowCursor. A HUD with its own hotkeys over a mouse-look character is an all document with <meta name="mouse-capture" content="true"/>.

A panel inside such a HUD that the player clicks, such as a debug or build menu shown with :if, carries data-mouse-release. While it is shown the cursor appears and the mouse works the panel; when it is hidden or removed, the mouse is captured again for mouse look. In a document without mouse-capture the attribute does nothing.

<meta name="mouse-capture" content="true"/>
<div class="debug-panel" :if="DebugOpen" data-mouse-release="">...</div>

More than one local player

Every local player has its own UArcRmlViewportSubsystem and its own layers and documents. Per player:

  • Layers: the layer root is created for the player's player controller and added to that player's screen. Each player has its own stack of documents.
  • Input: a document's input-mapping context is added to the Enhanced Input of the widget's owning local player, and its input mode goes to that player's CommonUI router.
  • View models: WorldContextObject of a function call is the player controller of the document's own player (Events).

Not per player:

  • The DPI scale: it comes from the whole viewport, so split-screen is not supported yet (Limits).
  • The console commands that act on a document, such as ArcRml.Open, act on the first local player only.