Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Direction Struct

    Namespace: Stride.Input
    Assembly: Stride.Input.dll

    Represents a direction or neutral position

    public struct Direction : IEquatable<Direction>
    Name Description
    Constructors
    Direction(Vector2)

    Creates a new direction from the given vector

    Fields
    Down
    Left
    LeftDown
    LeftUp
    None
    Right
    RightDown
    RightUp
    Up
    Properties
    IsNeutral

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

    Methods
    Equals(Direction)
    Equals(Object)
    FromTicks(Int32, Int32)

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

    GetHashCode()
    GetTicks(Int32)

    Retrieves the amount of ticks clockwise from the Up direction

    ToString()
    Operators
    Equality(Direction, Direction)
    Explicit(Vector2 to Direction)
    Explicit(Direction to Vector2)
    Inequality(Direction, Direction)
    | Improve this Doc View Source

    Constructors


    Direction(Vector2)

    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


    Down

    public static readonly Direction Down
    Field Value
    Type Description
    Direction

    Left

    public static readonly Direction Left
    Field Value
    Type Description
    Direction

    LeftDown

    public static readonly Direction LeftDown
    Field Value
    Type Description
    Direction

    LeftUp

    public static readonly Direction LeftUp
    Field Value
    Type Description
    Direction

    None

    public static readonly Direction None
    Field Value
    Type Description
    Direction

    Right

    public static readonly Direction Right
    Field Value
    Type Description
    Direction

    RightDown

    public static readonly Direction RightDown
    Field Value
    Type Description
    Direction

    RightUp

    public static readonly Direction RightUp
    Field Value
    Type Description
    Direction

    Up

    public static readonly Direction Up
    Field Value
    Type Description
    Direction
    | Improve this Doc View Source

    Properties


    IsNeutral

    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


    Equals(Direction)

    public bool Equals(Direction other)
    Parameters
    Type Name Description
    Direction other
    Returns
    Type Description
    System.Boolean

    Equals(Object)

    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.ValueType.Equals(System.Object)

    FromTicks(Int32, Int32)

    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


    GetHashCode()

    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.ValueType.GetHashCode()

    GetTicks(Int32)

    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

    ToString()

    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.ValueType.ToString()
    | Improve this Doc View Source

    Operators


    Equality(Direction, Direction)

    public static bool operator ==(Direction left, Direction right)
    Parameters
    Type Name Description
    Direction left
    Direction right
    Returns
    Type Description
    System.Boolean

    Explicit(Vector2 to Direction)

    public static explicit operator Direction(Vector2 value)
    Parameters
    Type Name Description
    Vector2 value
    Returns
    Type Description
    Direction

    Explicit(Direction to Vector2)

    public static explicit operator Vector2(Direction value)
    Parameters
    Type Name Description
    Direction value
    Returns
    Type Description
    Vector2

    Inequality(Direction, Direction)

    public static bool operator !=(Direction left, Direction right)
    Parameters
    Type Name Description
    Direction left
    Direction right
    Returns
    Type Description
    System.Boolean

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation