Package org.lwjgl.glfw
Class GLFWGamepadState
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.glfw.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.Member documentation
buttons[15]
– the states of each gamepad button,PRESS
orRELEASE
axes[6]
– 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GLFWGamepadState.Buffer
An array ofGLFWGamepadState
structs.
-
Constructor Summary
Constructors Constructor Description GLFWGamepadState(java.nio.ByteBuffer container)
Creates aGLFWGamepadState
instance at the current position of the specifiedByteBuffer
container.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.FloatBuffer
axes()
Returns aFloatBuffer
view of theaxes
field.float
axes(int index)
Returns the value at the specified index of theaxes
field.GLFWGamepadState
axes(int index, float value)
Sets the specified value at the specified index of theaxes
field.GLFWGamepadState
axes(java.nio.FloatBuffer value)
Copies the specifiedFloatBuffer
to theaxes
field.java.nio.ByteBuffer
buttons()
Returns aByteBuffer
view of thebuttons
field.byte
buttons(int index)
Returns the value at the specified index of thebuttons
field.GLFWGamepadState
buttons(int index, byte value)
Sets the specified value at the specified index of thebuttons
field.GLFWGamepadState
buttons(java.nio.ByteBuffer value)
Copies the specifiedByteBuffer
to thebuttons
field.static GLFWGamepadState
calloc()
Returns a newGLFWGamepadState
instance allocated withmemCalloc
.static GLFWGamepadState.Buffer
calloc(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated withmemCalloc
.static GLFWGamepadState
callocStack()
Returns a newGLFWGamepadState
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.static GLFWGamepadState.Buffer
callocStack(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.static GLFWGamepadState.Buffer
callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadState.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static GLFWGamepadState
callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadState
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static GLFWGamepadState
create()
Returns a newGLFWGamepadState
instance allocated withBufferUtils
.static GLFWGamepadState.Buffer
create(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated withBufferUtils
.static GLFWGamepadState
create(long address)
Returns a newGLFWGamepadState
instance for the specified memory address.static GLFWGamepadState.Buffer
create(long address, int capacity)
Create aGLFWGamepadState.Buffer
instance at the specified memory.static GLFWGamepadState
createSafe(long address)
static GLFWGamepadState.Buffer
createSafe(long address, int capacity)
static GLFWGamepadState
malloc()
Returns a newGLFWGamepadState
instance allocated withmemAlloc
.static GLFWGamepadState.Buffer
malloc(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated withmemAlloc
.static GLFWGamepadState
mallocStack()
Returns a newGLFWGamepadState
instance allocated on the thread-localMemoryStack
.static GLFWGamepadState.Buffer
mallocStack(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated on the thread-localMemoryStack
.static GLFWGamepadState.Buffer
mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadState.Buffer
instance allocated on the specifiedMemoryStack
.static GLFWGamepadState
mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadState
instance allocated on the specifiedMemoryStack
.static java.nio.FloatBuffer
naxes(long struct)
Unsafe version ofaxes()
.static float
naxes(long struct, int index)
Unsafe version ofaxes
.static void
naxes(long struct, int index, float value)
Unsafe version ofaxes
.static void
naxes(long struct, java.nio.FloatBuffer value)
Unsafe version ofaxes
.static java.nio.ByteBuffer
nbuttons(long struct)
Unsafe version ofbuttons()
.static byte
nbuttons(long struct, int index)
Unsafe version ofbuttons
.static void
nbuttons(long struct, int index, byte value)
Unsafe version ofbuttons
.static void
nbuttons(long struct, java.nio.ByteBuffer value)
Unsafe version ofbuttons
.GLFWGamepadState
set(java.nio.ByteBuffer buttons, java.nio.FloatBuffer axes)
Initializes this struct with the specified values.GLFWGamepadState
set(GLFWGamepadState src)
Copies the specified struct data to this struct.int
sizeof()
-
-
-
Constructor Detail
-
GLFWGamepadState
public GLFWGamepadState(java.nio.ByteBuffer container)
Creates aGLFWGamepadState
instance at the current position of the specifiedByteBuffer
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 classorg.lwjgl.system.Struct
-
buttons
public java.nio.ByteBuffer buttons()
Returns aByteBuffer
view of thebuttons
field.
-
buttons
public byte buttons(int index)
Returns the value at the specified index of thebuttons
field.
-
axes
public java.nio.FloatBuffer axes()
Returns aFloatBuffer
view of theaxes
field.
-
axes
public float axes(int index)
Returns the value at the specified index of theaxes
field.
-
buttons
public GLFWGamepadState buttons(java.nio.ByteBuffer value)
Copies the specifiedByteBuffer
to thebuttons
field.
-
buttons
public GLFWGamepadState buttons(int index, byte value)
Sets the specified value at the specified index of thebuttons
field.
-
axes
public GLFWGamepadState axes(java.nio.FloatBuffer value)
Copies the specifiedFloatBuffer
to theaxes
field.
-
axes
public GLFWGamepadState axes(int index, float value)
Sets the specified value at the specified index of theaxes
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 newGLFWGamepadState
instance allocated withmemAlloc
. The instance must be explicitly freed.
-
calloc
public static GLFWGamepadState calloc()
Returns a newGLFWGamepadState
instance allocated withmemCalloc
. The instance must be explicitly freed.
-
create
public static GLFWGamepadState create()
Returns a newGLFWGamepadState
instance allocated withBufferUtils
.
-
create
public static GLFWGamepadState create(long address)
Returns a newGLFWGamepadState
instance for the specified memory address.
-
createSafe
@Nullable public static GLFWGamepadState createSafe(long address)
-
malloc
public static GLFWGamepadState.Buffer malloc(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
public static GLFWGamepadState.Buffer calloc(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
public static GLFWGamepadState.Buffer create(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
public static GLFWGamepadState.Buffer create(long address, int capacity)
Create aGLFWGamepadState.Buffer
instance at the specified memory.- Parameters:
address
- the memory addresscapacity
- the buffer capacity
-
createSafe
@Nullable public static GLFWGamepadState.Buffer createSafe(long address, int capacity)
-
mallocStack
public static GLFWGamepadState mallocStack()
Returns a newGLFWGamepadState
instance allocated on the thread-localMemoryStack
.
-
callocStack
public static GLFWGamepadState callocStack()
Returns a newGLFWGamepadState
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.
-
mallocStack
public static GLFWGamepadState mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadState
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
callocStack
public static GLFWGamepadState callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadState
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocate
-
mallocStack
public static GLFWGamepadState.Buffer mallocStack(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated on the thread-localMemoryStack
.- Parameters:
capacity
- the buffer capacity
-
callocStack
public static GLFWGamepadState.Buffer callocStack(int capacity)
Returns a newGLFWGamepadState.Buffer
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.- Parameters:
capacity
- the buffer capacity
-
mallocStack
public static GLFWGamepadState.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadState.Buffer
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
callocStack
public static GLFWGamepadState.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadState.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
nbuttons
public static java.nio.ByteBuffer nbuttons(long struct)
Unsafe version ofbuttons()
.
-
nbuttons
public static byte nbuttons(long struct, int index)
Unsafe version ofbuttons
.
-
naxes
public static java.nio.FloatBuffer naxes(long struct)
Unsafe version ofaxes()
.
-
naxes
public static float naxes(long struct, int index)
Unsafe version ofaxes
.
-
nbuttons
public static void nbuttons(long struct, java.nio.ByteBuffer value)
Unsafe version ofbuttons
.
-
nbuttons
public static void nbuttons(long struct, int index, byte value)
Unsafe version ofbuttons
.
-
naxes
public static void naxes(long struct, java.nio.FloatBuffer value)
Unsafe version ofaxes
.
-
naxes
public static void naxes(long struct, int index, float value)
Unsafe version ofaxes
.
-
-