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.NativeResourceDescribes the input state of a gamepad.Member documentation
buttons– the states of each gamepad button,PRESSorRELEASEaxes– 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 and Description static classGLFWGamepadState.BufferAn array ofGLFWGamepadStatestructs.
-
Field Summary
Fields Modifier and Type Field and Description static intSIZEOFThe struct size in bytes.
-
Constructor Summary
Constructors Constructor and Description GLFWGamepadState(java.nio.ByteBuffer container)Creates aGLFWGamepadStateinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.nio.FloatBufferaxes()Returns aFloatBufferview of theaxesfield.GLFWGamepadStateaxes(java.nio.FloatBuffer value)Copies the specifiedFloatBufferto theaxesfield.floataxes(int index)Returns the value at the specified index of theaxesfield.GLFWGamepadStateaxes(int index, float value)Sets the specified value at the specified index of theaxesfield.java.nio.ByteBufferbuttons()Returns aByteBufferview of thebuttonsfield.GLFWGamepadStatebuttons(java.nio.ByteBuffer value)Copies the specifiedByteBufferto thebuttonsfield.bytebuttons(int index)Returns the value at the specified index of thebuttonsfield.GLFWGamepadStatebuttons(int index, byte value)Sets the specified value at the specified index of thebuttonsfield.static GLFWGamepadStatecalloc()Returns a newGLFWGamepadStateinstance allocated withmemCalloc.static GLFWGamepadState.Buffercalloc(int capacity)Returns a newGLFWGamepadState.Bufferinstance allocated withmemCalloc.static GLFWGamepadStatecallocStack()Returns a newGLFWGamepadStateinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.static GLFWGamepadState.BuffercallocStack(int capacity)Returns a newGLFWGamepadState.Bufferinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.static GLFWGamepadState.BuffercallocStack(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newGLFWGamepadState.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static GLFWGamepadStatecallocStack(org.lwjgl.system.MemoryStack stack)Returns a newGLFWGamepadStateinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static GLFWGamepadStatecreate()Returns a newGLFWGamepadStateinstance allocated withBufferUtils.static GLFWGamepadState.Buffercreate(int capacity)Returns a newGLFWGamepadState.Bufferinstance allocated withBufferUtils.static GLFWGamepadStatecreate(long address)Returns a newGLFWGamepadStateinstance for the specified memory address.static GLFWGamepadState.Buffercreate(long address, int capacity)Create aGLFWGamepadState.Bufferinstance at the specified memory.static GLFWGamepadStatecreateSafe(long address)static GLFWGamepadState.BuffercreateSafe(long address, int capacity)static GLFWGamepadStatemalloc()Returns a newGLFWGamepadStateinstance allocated withmemAlloc.static GLFWGamepadState.Buffermalloc(int capacity)Returns a newGLFWGamepadState.Bufferinstance allocated withmemAlloc.static GLFWGamepadStatemallocStack()Returns a newGLFWGamepadStateinstance allocated on the thread-localMemoryStack.static GLFWGamepadState.BuffermallocStack(int capacity)Returns a newGLFWGamepadState.Bufferinstance allocated on the thread-localMemoryStack.static GLFWGamepadState.BuffermallocStack(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newGLFWGamepadState.Bufferinstance allocated on the specifiedMemoryStack.static GLFWGamepadStatemallocStack(org.lwjgl.system.MemoryStack stack)Returns a newGLFWGamepadStateinstance allocated on the specifiedMemoryStack.GLFWGamepadStateset(java.nio.ByteBuffer buttons, java.nio.FloatBuffer axes)Initializes this struct with the specified values.GLFWGamepadStateset(GLFWGamepadState src)Copies the specified struct data to this struct.intsizeof()
-
-
-
Constructor Detail
-
GLFWGamepadState
public GLFWGamepadState(java.nio.ByteBuffer container)
Creates aGLFWGamepadStateinstance at the current position of the specifiedByteBuffercontainer. 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:
sizeofin classorg.lwjgl.system.Struct
-
buttons
public java.nio.ByteBuffer buttons()
Returns aByteBufferview of thebuttonsfield.
-
buttons
public byte buttons(int index)
Returns the value at the specified index of thebuttonsfield.
-
axes
public java.nio.FloatBuffer axes()
Returns aFloatBufferview of theaxesfield.
-
axes
public float axes(int index)
Returns the value at the specified index of theaxesfield.
-
buttons
public GLFWGamepadState buttons(java.nio.ByteBuffer value)
Copies the specifiedByteBufferto thebuttonsfield.
-
buttons
public GLFWGamepadState buttons(int index, byte value)
Sets the specified value at the specified index of thebuttonsfield.
-
axes
public GLFWGamepadState axes(java.nio.FloatBuffer value)
Copies the specifiedFloatBufferto theaxesfield.
-
axes
public GLFWGamepadState axes(int index, float value)
Sets the specified value at the specified index of theaxesfield.
-
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 newGLFWGamepadStateinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static GLFWGamepadState calloc()
Returns a newGLFWGamepadStateinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static GLFWGamepadState create()
Returns a newGLFWGamepadStateinstance allocated withBufferUtils.
-
create
public static GLFWGamepadState create(long address)
Returns a newGLFWGamepadStateinstance for the specified memory address.
-
createSafe
@Nullable public static GLFWGamepadState createSafe(long address)
-
malloc
public static GLFWGamepadState.Buffer malloc(int capacity)
Returns a newGLFWGamepadState.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static GLFWGamepadState.Buffer calloc(int capacity)
Returns a newGLFWGamepadState.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static GLFWGamepadState.Buffer create(int capacity)
Returns a newGLFWGamepadState.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static GLFWGamepadState.Buffer create(long address, int capacity)
Create aGLFWGamepadState.Bufferinstance 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 newGLFWGamepadStateinstance allocated on the thread-localMemoryStack.
-
callocStack
public static GLFWGamepadState callocStack()
Returns a newGLFWGamepadStateinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.
-
mallocStack
public static GLFWGamepadState mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadStateinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
callocStack
public static GLFWGamepadState callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newGLFWGamepadStateinstance allocated on the specifiedMemoryStackand 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.Bufferinstance allocated on the thread-localMemoryStack.- Parameters:
capacity- the buffer capacity
-
callocStack
public static GLFWGamepadState.Buffer callocStack(int capacity)
Returns a newGLFWGamepadState.Bufferinstance allocated on the thread-localMemoryStackand 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.Bufferinstance 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.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
-