Table of Contents

Struct Size

Allow representing different kinds of sizes, e.g. absolute or relative.
For convenience float will be implicitly converted to an absolute size, so any parameter expecting a Size can simply be passed a float value.

public struct Size

Constructors

Size(SizeMode, float)

public Size(SizeMode mode, float value)

Parameters

mode SizeMode
value float

Size(SizeMode, float, float)

public Size(SizeMode mode, float value, float maxSize)

Parameters

mode SizeMode
value float
maxSize float

Fields

maxSize

Limits the size when mode is Auto.

public float maxSize

Field Value

float

mode

How this size value is interpreted. See SizeMode.

public SizeMode mode

Field Value

SizeMode

value

The raw size value. What this represents depends on the mode of the size.
For relative size the value represents a percentage.

public float value

Field Value

float

Methods

Auto(float, float)

A convenience method for creating an Auto size.

public static Size Auto(float percent, float maxSize = 0)

Parameters

percent float
maxSize float

Returns

Size

Relative(float)

A convenience method for creating a Relative size.

public static Size Relative(float percent)

Parameters

percent float

Returns

Size

ToAbsolute()

Changes this Size to Absolute, without altering its value.

public void ToAbsolute()

ToAuto()

Changes this Size to Auto, without altering its value.

public void ToAuto()

ToRelative()

Changes this Size to Auto, without altering its value.

public void ToRelative()

Operators

implicit operator Size(SizeMode)

public static implicit operator Size(SizeMode mode)

Parameters

mode SizeMode

Returns

Size

implicit operator Size(float)

public static implicit operator Size(float size)

Parameters

size float

Returns

Size