-
Notifications
You must be signed in to change notification settings - Fork 6
/
simple example.ahk
44 lines (35 loc) · 906 Bytes
/
simple example.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
; Simplest usage example.
; Minimal error checking (Just check if DLL loaded), just the bare essentials code-wise.
#SingleInstance, force
#include <CvJoyInterface>
; Create an object from vJoy Interface Class.
vJoyInterface := new CvJoyInterface()
; Was vJoy installed and the DLL Loaded?
if (!vJoyInterface.vJoyEnabled()){
; Show log of what happened
Msgbox % vJoyInterface.LoadLibraryLog
ExitApp
}
myStick := vJoyInterface.Devices[1]
; End Startup Sequence
Return
; Hotkeys
F10::
; On press of F10 try and press button 1
myStick.SetBtn(1,1)
Return
F10 up::
; On release of F10, release button 1
myStick.SetBtn(0,1)
Return
; Hotkeys
F11::
; Refer to the stick by name, move it to 0%
myStick.SetAxisByName(0,"x")
SoundBeep
return
F12::
; Refer to the stick by index (axis number), move it to 100% (32768)
myStick.SetAxisByIndex(vJoyInterface.PercentTovJoy(100),1)
SoundBeep
return