-
Notifications
You must be signed in to change notification settings - Fork 3
Keyboard press simulation
NotGayBut5CentsAre5Cents edited this page Jun 7, 2018
·
1 revision
We use windowns dll files to make calls that generate a virtual keyboard press. DirectX based games don't use vkcodes instead they use scancodes (As from microsoft documentation)
We also use ctypes as it provides C compatible data types, and allows calling functions in DLLs or shared libraries.
We have predefined some things as instructed from documentation.
params:
hexKeyCode # the key code of the key to be virtually pressed
Simulates a keypress(holding down the key without releasing it)
params:
hexKeyCode # the key code of the key to be virtually pressed
same as the above function but releases the key instead.
And then we have helper functions to simulate common actions when driving the car:
def forward():,
def turn_left():,
def turn_right():,
def backwards():,
def full_stop():, # releases all key simulated from the other functions
#F stands for forward e.g turn left while going forward too
def turn_left_f():,
def turn_right_f():,
#Sadly we didnt get to use the reverse motion (R stands for reverse)
def turn_left_r():,
def turn_right_r():,