Class GLFWGamepadState

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

    public class GLFWGamepadState
    extends Struct
    implements NativeResource
    Describes the input state of a gamepad.

    Member documentation

    • buttons – the states of each gamepad button, PRESS or RELEASE
    • axes – the states of each gamepad axis, in the range -1.0 to 1.0 inclusive

    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()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • buttons

        public java.nio.ByteBuffer buttons()
        Returns a ByteBuffer view of the buttons field.
      • buttons

        public byte buttons​(int index)
        Returns the value at the specified index of the buttons field.
      • axes

        public java.nio.FloatBuffer axes()
        Returns a FloatBuffer view of the axes field.
      • axes

        public float axes​(int index)
        Returns the value at the specified index of the axes field.
      • 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
      • 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.
      • 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.