Skip to content

Class OrientationExtensions

Definition

Namespace: StardewUI.Layout
Assembly: StardewUI.dll

Helpers for working with Orientation.

public static class OrientationExtensions

Inheritance
Object ⇦ OrientationExtensions

Members

Methods

Name Description
CreateVector(Orientation, Single) Creates a new Vector2 with the oriented dimension set to a specified length and the other dimension set to zero.
Get(Orientation, Vector2) Gets the component of a vector along the orientation's axis.
Length(Orientation, LayoutParameters) Gets the dimension setting of a layout along the orientation's axis.
Set(Orientation, Vector2, Single) Sets the component of a vector corresponding to the orientation's axis.
Swap(Orientation) Gets the opposite/perpendicular orientation to a given orientation.
Update(Orientation, Vector2, Func<Single, Single>)

Details

Methods

CreateVector(Orientation, float)

Creates a new Vector2 with the oriented dimension set to a specified length and the other dimension set to zero.

public static Microsoft.Xna.Framework.Vector2 CreateVector(StardewUI.Layout.Orientation orientation, float length);
Parameters

orientation   Orientation
The orientation.

length   Single
The length along the orientation axis.

Returns

Vector2

A new Vector2 whose length along the orientation axis is length.


Get(Orientation, Vector2)

Gets the component of a vector along the orientation's axis.

public static float Get(StardewUI.Layout.Orientation orientation, Microsoft.Xna.Framework.Vector2 vec);
Parameters

orientation   Orientation
The orientation.

vec   Vector2
Any vector value.

Returns

Single

The vector's X component if Horizontal, or Y if Vertical.


Length(Orientation, LayoutParameters)

Gets the dimension setting of a layout along the orientation's axis.

public static StardewUI.Layout.Length Length(StardewUI.Layout.Orientation orientation, StardewUI.Layout.LayoutParameters layout);
Parameters

orientation   Orientation
The orientation.

layout   LayoutParameters
Layout parameters to extract from.

Returns

Length

The Width of the specified layout if the orientation is Horizontal; Height if Vertical.


Set(Orientation, Vector2, float)

Sets the component of a vector corresponding to the orientation's axis.

public static void Set(StardewUI.Layout.Orientation orientation, Microsoft.Xna.Framework.Vector2 vec, float value);
Parameters

orientation   Orientation
The orientation.

vec   Vector2
Any vector value.

value   Single
The new value for the specified axis.


Swap(Orientation)

Gets the opposite/perpendicular orientation to a given orientation.

public static StardewUI.Layout.Orientation Swap(StardewUI.Layout.Orientation orientation);
Parameters

orientation   Orientation
The orientation.

Returns

Orientation


Update(Orientation, Vector2, Func<Single, Single>)

public static float Update(StardewUI.Layout.Orientation orientation, Microsoft.Xna.Framework.Vector2 vec, Func<System.Single, System.Single> select);
Parameters

orientation   Orientation
The orientation.

vec   Vector2
Any vector value.

select   Func<Single, Single>
A function that takes the previous value and returns the updated value.

Returns

Single

The value after update.