我目前正在制作一个充当USB游戏控制器的程序,但我无法找到模拟按键和按键移动的方法......
我希望能使用python,但任何工作都可以。
答案 0 :(得分:0)
查看pyvjoy,它允许您在安装模拟器x360ce时模拟控制器。
看看这个火箭联盟机器人框架,代码可以让你模拟输入。
示例:
import pyvjoy
class PlayHelper:
def __init__(self, player_index):
self.device = pyvjoy.VJoyDevice(player_index + 1)
def update_controller(self, output):
self.device.data.wAxisX = output[0]
self.device.data.wAxisY = output[1]
self.device.data.wAxisZRot = output[2]
self.device.data.wAxisZ = output[3]
self.device.data.lButtons = (1 * output[4]) + (2 * output[5]) + (4 * output[6])
self.device.data.wAxisXRot = 16383
self.device.data.wAxisYRot = 16383
self.device.update() # Send data to vJoy device