Gostaria de conectar um Joystick DB-15 conectado à porta GamePort com o Elipse E3… Isto seria possível através de um script?
Encontrei o código abaixo para Visual Basic:
Dim x, xg As Long
Dim y, yg As Long
Dim start As Long
Dim status, i As Integer
Dim PortBits(8) As Integer
Dim PortNum As Long
Dim r As Long
Dim temp As Long
Dim xmax As Long
Dim xmin As Long
Dim xratg As Double
Dim ymax As Long
Dim ymin As Long
Dim yratg As Double
Dim formh As Long
Dim formw As Long
Dim ji As JOYINFOEX
Dim caps As JOYCAPS ’ joystick capabilities
Dim rc As Long
Private Sub Form_Load()
ji.dwSize = Len(ji)
ji.dwFlags = JOY_RETURNALL
' Get the current joystick data
rc = joyGetPosEx(JOYSTICKID1, ji)
If (rc <> 0) Then
MsgBox "Couldn't detect the joystick"
End
Else
temp = MsgBox("Hold the joystick to the right and click 'OK'", vbOKOnly, "Calibrate X")
rc = joyGetPosEx(JOYSTICKID1, ji)
xmax = ji.dwXpos
temp = MsgBox("Hold the joystick to the left and click 'OK'", vbOKOnly, "Calibrate X")
rc = joyGetPosEx(JOYSTICKID1, ji)
xmin = ji.dwXpos
temp = MsgBox("Hold the joystick down and click 'OK'", vbOKOnly, "Calibrate Y")
rc = joyGetPosEx(JOYSTICKID1, ji)
ymax = 32600 'ji.dwYpos
temp = MsgBox("Hold the joystick up and click 'OK'", vbOKOnly, "Calibrate Y")
rc = joyGetPosEx(JOYSTICKID1, ji)
ymin = 0 'ji.dwYpos
End If
formw = 8200
formh = 6300
xratg = formw / (xmax - xmin)
yratg = formh / (ymax - ymin)
r = 50
End Sub
Alguem sabe dizer se é possível adaptar esse código para VBScript?
Link do artigo original: http://www.pages.drexel.edu/~kws23/tutorials/joyWin/joyWin.html