This document outlines the structure and types of events transmitted in the event-driven JSON format for gamepad, keyboard, and mouse inputs.
{
"events": [
{"type": "gamepadButton", "button": "A", "state": true},
{"type": "keyboard", "key": "space", "state": true},
{"type": "axis", "axis": "leftX", "value": 0.5},
{"type": "trigger", "trigger": "leftTrigger", "value": 1.0},
{"type": "mouseButton", "button": "leftClick", "state": true}
]
}
{
"events": [
{"type": "gamepadButton", "button": "A", "state": true}
]
}
{
"events": [
{"type": "gamepadButton", "button": "A", "state": false}
]
}
- Type:
gamepadButton
- Properties:
button
: String - The specific gamepad button (A
,B
,X
,Y
,LEFT_SHOULDER
,RIGHT_SHOULDER
,LEFT_THUMB
,RIGHT_THUMB
,BACK
,START
,GUIDE
,DPAD_UP
,DPAD_DOWN
,DPAD_LEFT
,DPAD_RIGHT
).state
: Boolean - Indicates whether the button is pressed (true
) or released (false
).
- Type:
axis
- Properties:
axis
: String - The specific axis being reported (e.g.,leftX
,leftY
,rightX
,rightY
,dpadHorz
,dpadVert
).value
: Number - Numeric value ranging from-1
to1
indicating the position of the axis.
- Type:
trigger
- Properties:
trigger
: String - The specific trigger (e.g.,leftTrigger
,rightTrigger
).value
: Number - Numeric value ranging from0
to1
indicating the pressure applied to the trigger.
- Type:
mouseButton
- Properties:
button
: String - The specific mouse button (e.g.,leftClick
,middleClick
,rightClick
).state
: Boolean - Indicates whether the button is pressed (true
) or released (false
).
- Type:
keyboard
- Properties:
-
key
:a
throughz
(representing each letter of the alphabet)0
through9
(representing the top row number keys)numpad_0
throughnumpad_9
(representing the numeric keypad numbers)backspace
delete
enter
tab
escape
up
,down
,left
,right
(arrow keys)home
end
pageup
,pagedown
f1
throughf12
(function keys)alt
control
shift
space
windows
play
pause
mute
fn
-
state
: Boolean - Indicates whether the key is pressed (true
) or released (false
).
-