Direction Struct
Namespace: Stride.Input
Assembly: Stride.Input.dll
Represents a direction or neutral position
public struct Direction : IEquatable<Direction>
|
Improve this Doc
View Source
Constructors
Creates a new direction from the given vector
public Direction(Vector2 direction)
Parameters
| Type |
Name |
Description |
| Vector2 |
direction |
A normalized 2d direction or Zero for a neutral position
|
|
Improve this Doc
View Source
Fields
public static readonly Direction Down
Field Value
public static readonly Direction Left
Field Value
public static readonly Direction LeftDown
Field Value
public static readonly Direction LeftUp
Field Value
public static readonly Direction None
Field Value
public static readonly Direction Right
Field Value
public static readonly Direction RightDown
Field Value
public static readonly Direction RightUp
Field Value
public static readonly Direction Up
Field Value
|
Improve this Doc
View Source
Properties
true if the direction is in a neutral position. Same as checking against Direction.None
public readonly bool IsNeutral { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
|
Improve this Doc
View Source
Methods
public bool Equals(Direction other)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
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
| Type |
Name |
Description |
| System.Int32 |
value |
The amount of ticks clockwise from the Up direction (numerator)
|
| System.Int32 |
maxValue |
The number of ticks representing a full rotation (denominator)
|
Returns
| Type |
Description |
| Direction |
A direction with ratio value over maxValue
|
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
Retrieves the amount of ticks clockwise from the Up direction
public int GetTicks(int maxValue)
Parameters
| Type |
Name |
Description |
| System.Int32 |
maxValue |
The number of ticks representing a full rotation
|
Returns
| Type |
Description |
| System.Int32 |
|
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.ValueType.ToString()
|
Improve this Doc
View Source
Operators
public static bool operator ==(Direction left, Direction right)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
public static explicit operator Direction(Vector2 value)
Parameters
| Type |
Name |
Description |
| Vector2 |
value |
|
Returns
public static explicit operator Vector2(Direction value)
Parameters
Returns
public static bool operator !=(Direction left, Direction right)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Extension Methods