Class GLFWGamepadState

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

    public class GLFWGamepadState
    extends org.lwjgl.system.Struct
    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 Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • BUTTONS, AXES

        The struct member offsets.
    • Constructor Detail

      • GLFWGamepadState

        public GLFWGamepadState​(java.nio.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 Detail

      • sizeof

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

        public java.nio.ByteBuffer buttons()
        
        public byte buttons​(int index)
        
        the states of each gamepad button, PRESS or RELEASE
      • axes

        public java.nio.FloatBuffer 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​(java.nio.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​(java.nio.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​(java.nio.ByteBuffer buttons,
                                    java.nio.FloatBuffer axes)
        Initializes this struct with the specified values.
      • set

        public GLFWGamepadState set​(GLFWGamepadState src)
        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.
      • 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​(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.
      • 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:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • 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:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • nbuttons

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

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

        public static java.nio.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,
                                    java.nio.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,
                                 java.nio.FloatBuffer value)
        Unsafe version of axes.
      • naxes

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