Table of Contents

Struct Direction

Namespace
Stride.Input
Assembly
Stride.Input.dll

Represents a direction or neutral position

public struct Direction : IEquatable<Direction>
Implements

Constructors

Direction(Vector2)

Creates a new direction from the given vector

public Direction(Vector2 direction)

Parameters

direction Vector2

A normalized 2d direction or Zero for a neutral position

Fields

Down

public static readonly Direction Down

Field Value

Direction

Left

public static readonly Direction Left

Field Value

Direction

LeftDown

public static readonly Direction LeftDown

Field Value

Direction

LeftUp

public static readonly Direction LeftUp

Field Value

Direction

None

public static readonly Direction None

Field Value

Direction

Right

public static readonly Direction Right

Field Value

Direction

RightDown

public static readonly Direction RightDown

Field Value

Direction

RightUp

public static readonly Direction RightUp

Field Value

Direction

Up

public static readonly Direction Up

Field Value

Direction

Properties

IsNeutral

true if the direction is in a neutral position. Same as checking against Direction.None

public bool IsNeutral { get; }

Property Value

bool

Methods

Equals(Direction)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Direction other)

Parameters

other Direction

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

FromTicks(int, int)

Creates a new direction from a ratio. with 0/1 corresponding to the direction (0,1), 1/4 corresponding to (1,0), etc.

public static Direction FromTicks(int value, int maxValue)

Parameters

value int

The amount of ticks clockwise from the Up direction (numerator)

maxValue int

The number of ticks representing a full rotation (denominator)

Returns

Direction

A direction with ratio value over maxValue

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

GetTicks(int)

Retrieves the amount of ticks clockwise from the Up direction

public int GetTicks(int maxValue)

Parameters

maxValue int

The number of ticks representing a full rotation

Returns

int

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(Direction, Direction)

public static bool operator ==(Direction left, Direction right)

Parameters

left Direction
right Direction

Returns

bool

explicit operator Direction(Vector2)

public static explicit operator Direction(Vector2 value)

Parameters

value Vector2

Returns

Direction

explicit operator Vector2(Direction)

public static explicit operator Vector2(Direction value)

Parameters

value Direction

Returns

Vector2

operator !=(Direction, Direction)

public static bool operator !=(Direction left, Direction right)

Parameters

left Direction
right Direction

Returns

bool