一开始想采用PyAutoGUI,然后GTA并不支持,遂采用DirectX的输入模式
这部分的代码看不太懂了,我就Github上搜了一下代码,然后调整了一下。
Kyes.py文件
键盘映射,主要是把键位映射为DirectX能读的形式(16进制的一串字符),定义如下
class Key_Mapping:
num1 = 0x02
num2 = 0x03
num3 = 0x04
num4 = 0x05
num5 = 0x06
num6 = 0x07
num7 = 0x08
num8 = 0x09
num9 = 0x0a
num0 = 0x0b
escape = 0x01
equal = 0x0d
backspace = 0x0e
tab = 0x0f
q = 0x10
w = 0x11
e = 0x12
r = 0x13
t = 0x14
y = 0x15
u = 0x16
i = 0x17
o = 0x18
p = 0x19
enter = 0x1c
lcontrol = 0x1d
a = 0x1e
s = 0x1f
d = 0x20
f = 0x21
g =