Class GLFWGamepadState

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<GLFWGamepadState>
org.lwjgl.glfw.GLFWGamepadState
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class GLFWGamepadState extends org.lwjgl.system.Struct<GLFWGamepadState> implements org.lwjgl.system.NativeResource
Describes the input state of a gamepad.

Layout


 struct GLFWgamepadstate {
     unsigned char buttons()[15];
     float axes()[6];
 }
Since:
version 3.3
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • BUTTONS

      public static final int BUTTONS
      The struct member offsets.
    • AXES

      public static final int AXES
      The struct member offsets.
  • Constructor Details

    • GLFWGamepadState

      public GLFWGamepadState(ByteBuffer container)
      Creates a GLFWGamepadState instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Specified by:
      sizeof in class org.lwjgl.system.Struct<GLFWGamepadState>
    • buttons

      public ByteBuffer buttons()
      the states of each gamepad button, PRESS or RELEASE
    • buttons

      public byte buttons(int index)
      the states of each gamepad button, PRESS or RELEASE
    • axes

      public FloatBuffer axes()
      the states of each gamepad axis, in the range -1.0 to 1.0 inclusive
    • axes

      public float axes(int index)
      the states of each gamepad axis, in the range -1.0 to 1.0 inclusive
    • buttons

      public GLFWGamepadState buttons(ByteBuffer value)
      Copies the specified ByteBuffer to the buttons() field.
    • buttons

      public GLFWGamepadState buttons(int index, byte value)
      Sets the specified value at the specified index of the buttons() field.
    • axes

      public GLFWGamepadState axes(FloatBuffer value)
      Copies the specified FloatBuffer to the axes() field.
    • axes

      public GLFWGamepadState axes(int index, float value)
      Sets the specified value at the specified index of the axes() field.
    • set

      public GLFWGamepadState set(ByteBuffer buttons, FloatBuffer axes)
      Initializes this struct with the specified values.
    • set

      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static GLFWGamepadState malloc()
      Returns a new GLFWGamepadState instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static GLFWGamepadState calloc()
      Returns a new GLFWGamepadState instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static GLFWGamepadState create()
      Returns a new GLFWGamepadState instance allocated with BufferUtils.
    • create

      public static GLFWGamepadState create(long address)
      Returns a new GLFWGamepadState instance for the specified memory address.
    • createSafe

      @Nullable public static GLFWGamepadState createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static GLFWGamepadState.Buffer malloc(int capacity)
      Returns a new GLFWGamepadState.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static GLFWGamepadState.Buffer calloc(int capacity)
      Returns a new GLFWGamepadState.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static GLFWGamepadState.Buffer create(int capacity)
      Returns a new GLFWGamepadState.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static GLFWGamepadState.Buffer create(long address, int capacity)
      Create a GLFWGamepadState.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      @Nullable public static GLFWGamepadState.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • mallocStack

      @Deprecated public static GLFWGamepadState mallocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static GLFWGamepadState callocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static GLFWGamepadState mallocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static GLFWGamepadState callocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static GLFWGamepadState.Buffer mallocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static GLFWGamepadState.Buffer callocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • mallocStack

      @Deprecated public static GLFWGamepadState.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static GLFWGamepadState.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • malloc

      public static GLFWGamepadState malloc(org.lwjgl.system.MemoryStack stack)
      Returns a new GLFWGamepadState instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static GLFWGamepadState calloc(org.lwjgl.system.MemoryStack stack)
      Returns a new GLFWGamepadState instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static GLFWGamepadState.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new GLFWGamepadState.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static GLFWGamepadState.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new GLFWGamepadState.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nbuttons

      public static ByteBuffer nbuttons(long struct)
      Unsafe version of buttons().
    • nbuttons

      public static byte nbuttons(long struct, int index)
      Unsafe version of buttons.
    • naxes

      public static FloatBuffer naxes(long struct)
      Unsafe version of axes().
    • naxes

      public static float naxes(long struct, int index)
      Unsafe version of axes.
    • nbuttons

      public static void nbuttons(long struct, ByteBuffer value)
      Unsafe version of buttons.
    • nbuttons

      public static void nbuttons(long struct, int index, byte value)
      Unsafe version of buttons.
    • naxes

      public static void naxes(long struct, FloatBuffer value)
      Unsafe version of axes.
    • naxes

      public static void naxes(long struct, int index, float value)
      Unsafe version of axes.