Class Vector2

java.lang.Object
com.raylib.Vector2

public class Vector2 extends Object
Vector2, 2 components
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The native FFI MemorySegment that holds the data this object wraps.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct with auto memory allocator and fields initialized to zero.
    Vector2(float x, float y)
    Construct with auto memory allocator and fields initialized as specified
    Vector2(MemorySegment memorySegment)
    Construct by wrapping around an already allocated MemorySegment, perhaps from another object
    Construct with your owm memory allocator and fields not initialized
    Vector2(SegmentAllocator arena, float x, float y)
    Construct with your own memory allocator and fields initialized as specified
  • Method Summary

    Modifier and Type
    Method
    Description
    static Vector2
    allocateArray(long elementCount)
    Allocate an array of Vector2
    static Vector2
    allocateArray(long elementCount, SegmentAllocator allocator)
    Allocate an array of Vector2
    boolean
    Equality is tested on basis of both wrapper objects must refer to same native memory location to be considered equal
    getArrayElement(int index)
     
    float
    Vector x component
    float
    Vector y component
    int
     
    void
    setX(float value)
    Vector x component
    void
    setY(float value)
    Vector y component
    float
    x()
    Vector x component
    x(float value)
    Vector x component
    float
    y()
    Vector y component
    y(float value)
    Vector y component

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • memorySegment

      public final MemorySegment memorySegment
      The native FFI MemorySegment that holds the data this object wraps.
  • Constructor Details

    • Vector2

      public Vector2()
      Construct with auto memory allocator and fields initialized to zero.
    • Vector2

      public Vector2(SegmentAllocator arena)
      Construct with your owm memory allocator and fields not initialized
    • Vector2

      public Vector2(MemorySegment memorySegment)
      Construct by wrapping around an already allocated MemorySegment, perhaps from another object
    • Vector2

      public Vector2(float x, float y)
      Construct with auto memory allocator and fields initialized as specified
      Parameters:
      x - Vector x component
      y - Vector y component
    • Vector2

      public Vector2(SegmentAllocator arena, float x, float y)
      Construct with your own memory allocator and fields initialized as specified
      Parameters:
      x - Vector x component
      y - Vector y component
  • Method Details

    • equals

      public boolean equals(Object o)
      Equality is tested on basis of both wrapper objects must refer to same native memory location to be considered equal
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getArrayElement

      public Vector2 getArrayElement(int index)
    • allocateArray

      public static Vector2 allocateArray(long elementCount, SegmentAllocator allocator)
      Allocate an array of Vector2
    • allocateArray

      public static Vector2 allocateArray(long elementCount)
      Allocate an array of Vector2
    • getX

      public float getX()
      Vector x component
    • setX

      public void setX(float value)
      Vector x component
    • x

      public float x()
      Vector x component
    • x

      public Vector2 x(float value)
      Vector x component
    • getY

      public float getY()
      Vector y component
    • setY

      public void setY(float value)
      Vector y component
    • y

      public float y()
      Vector y component
    • y

      public Vector2 y(float value)
      Vector y component