noccylabs/joystick
Composer 安装命令:
composer require noccylabs/joystick
包简介
Joystick access via /dev/input (linux only)
README 文档
README
This is a small library to read connected gamepads via /dev/input/js0 etc. As
it uses /dev/input it only supports Linux. It can be used to create configs
with keybindings for games, xboxdrv etc.
Install
For development version:
$ composer require noccylabs/joystick:dev-master
Examples
Example 1: Using raw events
$js = new \NoccyLabs\Joystick\Joystick(0);
echo "Press a button on joystick 0 ... ";
while (true) {
$raw = $js->getRawEvent();
if ($raw['type'] & JS_EVENT_BUTTON) {
echo "Thank you!\n";
break;
}
}
Example 2: Using the JoystickState
$js = new \NoccyLabs\Joystick\Joystick(0);
echo "Press button 1 on joystick 0 ... ";
while ($state = $js->update()) {
if ($state->getButton(1)) {
echo "Thank you!\n";
break;
}
}
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2014-11-04