API reference
Preparing search index…

Vector2<T>

sf::Vector2, with a native handle lazily bound to its existing storage.

Type Parameters

Type hierarchy

Hierarchy (View Summary)

Source & inheritance
Member directory20

Constructors

Properties

Accessors

Methods

Constructors

  • Create a 2D vector of the specified scalar type; omitted components are zero. A source vector can also be converted and copied.

    Type Parameters

    • T extends "i8" | "u8" | "i16" | "u16" | "i32" | "u32" | "i64" | "u64" | "f32" | "f64"

    Parameters

    scalarType

    Component storage type; i64/u64 use bigint, others use number.

    ...args
    Vector2Arguments<T> | (T extends FloatScalar ? PolarArguments : never)

    x and y components or a source vector; floating-point types also support polar coordinates with a radius and an Angle.

    Returns

    Source & inheritance
  • Copy the vector and its scalar type with independent storage.

    Type Parameters

    • T extends "i8" | "u8" | "i16" | "u16" | "i32" | "u32" | "i64" | "u64" | "f32" | "f64"

    Parameters

    Returns

    Source & inheritance

Accessors

  • get x(): Scalar<T>

    The X component; writes follow the TypedArray conversion rules for scalarType.

    Returns

    Scalar<T>
    Source & inheritance
  • set x(value: Scalar<T>): void

    Set the X component.

    Parameters

    value
    Scalar<T>

    Returns

    void
    Source & inheritance
  • get y(): Scalar<T>

    The Y component; writes follow the TypedArray conversion rules for scalarType.

    Returns

    Scalar<T>
    Source & inheritance
  • set y(value: Scalar<T>): void

    Set the Y component.

    Parameters

    value
    Scalar<T>

    Returns

    void
    Source & inheritance

Methods

  • Return x²+y², calculated with the current scalar type's precision and range.

    Returns

    Scalar<T>
    Source & inheritance

Symbol members

"[mutableValue]": true
Source & inheritance
  • get "[vector2Native]"(): NativeValueHandle<"vector2">

    Returns

    NativeValueHandle<"vector2">
    Source & inheritance

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0