Skip to content

Class FullScreenOverlay

Definition

Namespace: StardewUI.Overlays
Assembly: StardewUI.dll

Base class for an overlay meant to take up the full screen.

public class FullScreenOverlay : StardewUI.Overlays.IOverlay

Inheritance
Object ⇦ FullScreenOverlay

Implements
IOverlay

Members

Constructors

Name Description
FullScreenOverlay() Initializes a new instance of FullScreenOverlay.

Properties

Name Description
CapturingInput Whether the overlay wants to capture all keyboard and gamepad inputs, i.e. prevent them from being dispatched to the parent menu.
DimmingAmount Amount to dim whatever is underneath the overlay.
HorizontalAlignment Horizontal alignment of the overlay relative to the Parent edge.
HorizontalParentAlignment Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its HorizontalAlignment.
Parent The parent of this overlay, used for positioning. If not specified, then the overlay will be positioned relative to the entire UI viewport.
ParentOffset Additional pixel offset to apply to the overlay's position, after alignments.
VerticalAlignment Vertical alignment of the overlay relative to the Parent edge.
VerticalParentAlignment Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its VerticalAlignment.
View The view to be displayed/interacted with as an overlay.

Methods

Name Description
CreateView() Creates the content view that will be displayed as an overlay.
OnClose() Runs when the overlay is removed from the active stack.
RequireView<TChild>(Func<TChild>) Ensures that the overlay view is created before attempting to access a child view.
Update(TimeSpan) Runs on every game update tick.

Events

Name Description
Close Event raised when the overlay is closed - i.e. removed from the current context stack.

Details

Constructors

FullScreenOverlay()

Initializes a new instance of FullScreenOverlay.

public FullScreenOverlay();

Properties

CapturingInput

Whether the overlay wants to capture all keyboard and gamepad inputs, i.e. prevent them from being dispatched to the parent menu.

public bool CapturingInput { get; protected set; }
Property Value

Boolean

Remarks

This is not necessary to trap focus, which happens automatically; only to capture buttons/keys that would normally have a navigation function, like triggers/shoulders for paging, E/Esc/GamepadB for cancellation, etc. Overlays that enable capturing should provide their own way for the user to escape using keyboard/gamepad, although it is always possible to click the mouse outside the overlay to dismiss it (and implicitly stop the capturing).


DimmingAmount

Amount to dim whatever is underneath the overlay.

public float DimmingAmount { get; set; }
Property Value

Single

Remarks

This is an alpha value for a black overlay, so the higher value (between 0 and 1) the darker the content underneath the overlay. These apply individually to each overlay, so multiple stacked overlays will dim not only the underlying main view but also any previous overlays.


HorizontalAlignment

Horizontal alignment of the overlay relative to the Parent edge.

public StardewUI.Layout.Alignment HorizontalAlignment { get; }
Property Value

Alignment

Remarks

Full-screen overlays should generally stretch to the entire viewport dimensions, but are middle-aligned in case of a discrepancy.


HorizontalParentAlignment

Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its HorizontalAlignment.

public StardewUI.Layout.Alignment HorizontalParentAlignment { get; }
Property Value

Alignment

Remarks

Full-screen overlays should generally stretch to the entire viewport dimensions, but are middle-aligned in case of a discrepancy.


Parent

The parent of this overlay, used for positioning. If not specified, then the overlay will be positioned relative to the entire UI viewport.

public StardewUI.IView Parent { get; }
Property Value

IView

Remarks

Full-screen overlays always have a null parent.


ParentOffset

Additional pixel offset to apply to the overlay's position, after alignments.

public Microsoft.Xna.Framework.Vector2 ParentOffset { get; }
Property Value

Vector2


VerticalAlignment

Vertical alignment of the overlay relative to the Parent edge.

public StardewUI.Layout.Alignment VerticalAlignment { get; }
Property Value

Alignment

Remarks

Full-screen overlays should generally stretch to the entire viewport dimensions, but are middle-aligned in case of a discrepancy.


VerticalParentAlignment

Specifies which edge of the Parent (or screen, if no parent is specified) will be used to align the overlay edge denoted by its VerticalAlignment.

public StardewUI.Layout.Alignment VerticalParentAlignment { get; }
Property Value

Alignment

Remarks

Full-screen overlays should generally stretch to the entire viewport dimensions, but are middle-aligned in case of a discrepancy.


View

The view to be displayed/interacted with as an overlay.

public StardewUI.IView View { get; }
Property Value

IView

Remarks

The view provided in a full-screen overlay is a dimming frame with the content view inside.


Methods

CreateView()

Creates the content view that will be displayed as an overlay.

protected virtual StardewUI.IView CreateView();
Returns

IView


OnClose()

Runs when the overlay is removed from the active stack.

public void OnClose();

RequireView<TChild>(Func<TChild>)

Ensures that the overlay view is created before attempting to access a child view.

protected TChild RequireView<TChild>(Func<TChild> viewSelector);
Parameters

viewSelector   Func<TChild>
Function to retrieve the inner view.

Returns

TChild

The inner view.

Remarks

This is syntactic sugar over accessing View first to force lazy loading.


Update(TimeSpan)

Runs on every game update tick.

public virtual void Update(System.TimeSpan elapsed);
Parameters

elapsed   TimeSpan
The amount of real time elapsed since the last tick.


Events

Close

Event raised when the overlay is closed - i.e. removed from the current context stack.

public event EventHandler<System.EventArgs>? Close;
Event Type

EventHandler<EventArgs>