java.lang.Object
overrungl.Pointer
overrungl.Struct
overrungl.glfw.GLFWGamepadState
- All Implemented Interfaces:
Addressable
GLFWGamepadState
relies on preview features of the Java platform:
GLFWGamepadState
refers to one or more preview APIs:MemorySegment
,SegmentAllocator
,SequenceLayout
,StructLayout
.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
This describes the input state of a gamepad.
Layout
struct GLFWgamepadstate {
unsigned char buttons
[15];
float axes
[6];
}
- Since:
- 0.1.0
- Author:
- squid233
-
Field Summary
Modifier and TypeFieldDescriptionstatic final SequenceLayoutPREVIEW
The struct member layout.static final SequenceLayoutPREVIEW
The struct member layout.static final StructLayoutPREVIEW
The struct layout.Fields inherited from class overrungl.Pointer
address, allocator, managedSegment
-
Constructor Summary
ConstructorDescriptionGLFWGamepadState
(MemorySegmentPREVIEW address, SegmentAllocatorPREVIEW allocator) Create aGLFWgamepadstate
instance. -
Method Summary
Modifier and TypeMethodDescriptionfloat
axe
(int index) Gets the axe state at the given index.float[]
axes()
Gets the axe state array.boolean
button
(int index) Gets the button state at the given index.byte[]
buttons()
Gets the button state array.static GLFWGamepadState
create
(SegmentAllocatorPREVIEW allocator) Creates aGLFWgamepadstate
instance with the given allocator.
-
Field Details
-
BUTTONS_LAYOUT
The struct member layout. -
AXES_LAYOUT
The struct member layout. -
LAYOUT
The struct layout.
-
-
Constructor Details
-
GLFWGamepadState
Create aGLFWgamepadstate
instance.- Parameters:
address
- the address.allocator
- the allocator of this address.
-
-
Method Details
-
create
Creates aGLFWgamepadstate
instance with the given allocator.- Parameters:
allocator
- the allocator- Returns:
- the instance
-
buttons
public byte[] buttons()Gets the button state array.- Returns:
- The states of each gamepad button,
PRESS
orRELEASE
.
-
button
public boolean button(int index) Gets the button state at the given index.- Parameters:
index
- the index- Returns:
- the state,
PRESS
orRELEASE
-
axes
public float[] axes()Gets the axe state array.- Returns:
- The states of each gamepad axis, in the range -1.0 to 1.0 inclusive.
-
axe
public float axe(int index) Gets the axe state at the given index.- Parameters:
index
- the index- Returns:
- the state, in the range -1.0 to 1.0 inclusive
-
GLFWGamepadState
when preview features are enabled.