evilc
New Member
Posts: 32
|
Post by evilc on Jul 6, 2017 19:53:51 GMT
For now, I just wrap Shaul's C# wrapper, but if this goes further, I would probably consider making it stand-alone. This is modeled on how I did my AHK wrapper for old vJoy. No need to Acquire or Relinquish, it is all handled for you. Just instantiate the class from the DLL instance.vJoy.Device(n) will return a vJoy device object instance.vXboy.Device(n) will return a vXbox device object Then just call eg SetAxis on the device object. (Currently, only SetAxis is implemented) Github page: github.com/evilC/vGenExample simplst AHK code using this wrapper: #SingleInstance force
; Load CLR library that allows us to load C# DLLs
#include CLR.ahk
; Instantiate class from C# DLL
asm := CLR_LoadLibrary("vGenBasicWrapper.dll")
vGen := asm.CreateInstance("vGenBasicWrapper")
; Get device object for vJoy stick 1 vj := vGen.vJoy.Device(1)
vj.SetAxis(1, 100) ; Set axis 1 to 100%
Sleep, 1000
vj.SetAxis(1, 0) ; Set axis 1 to 0%
More complicated, uses vJoy and vXbox: #SingleInstance force
; Load CLR library that allows us to load C# DLLs
#include CLR.ahk
; Instantiate class from C# DLL
asm := CLR_LoadLibrary("vGenBasicWrapper.dll")
vGen := asm.CreateInstance("vGenBasicWrapper")
vj := vGen.vJoy.Device(1)
vx := vGen.vXbox.Device(1)
JoyPos := 0
JoyDir := -1
SetTimer, UpdatevJoy, 10
return
UpdatevJoy:
vj.SetAxis(1, JoyPos)
vx.SetAxis(1, JoyPos)
if (JoyPos == 100 || JoyPos == 0)
JoyDir *= -1
JoyPos += JoyDir
return
^Esc::
ExitApp
Edit: eww, this forum inserts a lot of blank lines into code
|
|
evilc
New Member
Posts: 32
|
Post by evilc on Jul 18, 2017 19:06:45 GMT
|
|