|
@@ -38,128 +38,128 @@ Type TSDLJoystickDriver Extends TJoystickDriver
|
|
|
Field currentPort:Int = -1
|
|
|
Field currentJoystick:TSDLJoystick
|
|
|
|
|
|
- Method GetName:String()
|
|
|
+ Method GetName:String() Override
|
|
|
Return "SDL Joystick"
|
|
|
End Method
|
|
|
|
|
|
- Method JoyCount:Int()
|
|
|
+ Method JoyCount:Int() Override
|
|
|
Return SDL_NumJoysticks()
|
|
|
End Method
|
|
|
|
|
|
- Method JoyName:String(port:Int)
|
|
|
+ Method JoyName:String(port:Int) Override
|
|
|
Return String.FromUTF8String(SDL_JoystickNameForIndex(port))
|
|
|
End Method
|
|
|
|
|
|
- Method JoyButtonCaps:Int(port:Int)
|
|
|
+ Method JoyButtonCaps:Int(port:Int) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickNumButtons(currentJoystick.joystickPtr)
|
|
|
End Method
|
|
|
|
|
|
- Method JoyAxisCaps:Int(port:Int)
|
|
|
+ Method JoyAxisCaps:Int(port:Int) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickNumAxes(currentJoystick.joystickPtr)
|
|
|
End Method
|
|
|
|
|
|
- Method JoyDown:Int( button:Int, port:Int=0 )
|
|
|
+ Method JoyDown:Int( button:Int, port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetButton(currentJoystick.joystickPtr, button)
|
|
|
End Method
|
|
|
|
|
|
- Method JoyHit:Int( button:Int, port:Int=0 )
|
|
|
+ Method JoyHit:Int( button:Int, port:Int=0 ) Override
|
|
|
End Method
|
|
|
|
|
|
- Method JoyX#( port:Int=0 )
|
|
|
+ Method JoyX#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_X)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyY#( port:Int=0 )
|
|
|
+ Method JoyY#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_Y)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyZ#( port:Int=0 )
|
|
|
+ Method JoyZ#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_Z)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyR#( port:Int=0 )
|
|
|
+ Method JoyR#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_R)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyU#( port:Int=0 )
|
|
|
+ Method JoyU#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_U)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyV#( port:Int=0 )
|
|
|
+ Method JoyV#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_V)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyYaw#( port:Int=0 )
|
|
|
+ Method JoyYaw#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_YAW)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyPitch#( port:Int=0 )
|
|
|
+ Method JoyPitch#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_PITCH)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyRoll#( port:Int=0 )
|
|
|
+ Method JoyRoll#( port:Int=0 ) Override
|
|
|
SampleJoy port
|
|
|
Return SDL_JoystickGetAxis(currentJoystick.joystickPtr, JOY_ROLL)/32767.0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyHat#( port:Int=0 )
|
|
|
+ Method JoyHat#( port:Int=0 ) Override
|
|
|
End Method
|
|
|
|
|
|
- Method JoyWheel#( port:Int=0 )
|
|
|
+ Method JoyWheel#( port:Int=0 ) Override
|
|
|
End Method
|
|
|
|
|
|
- Method JoyType:Int( port:Int=0 )
|
|
|
+ Method JoyType:Int( port:Int=0 ) Override
|
|
|
If port<JoyCount() Return 1
|
|
|
Return 0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyXDir:Int( port:Int=0 )
|
|
|
+ Method JoyXDir:Int( port:Int=0 ) Override
|
|
|
Local t#=JoyX( port )
|
|
|
If t<.333333 Return -1
|
|
|
If t>.333333 Return 1
|
|
|
Return 0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyYDir:Int( port:Int=0 )
|
|
|
+ Method JoyYDir:Int( port:Int=0 ) Override
|
|
|
Local t#=JoyY( port )
|
|
|
If t<.333333 Return -1
|
|
|
If t>.333333 Return 1
|
|
|
Return 0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyZDir:Int( port:Int=0 )
|
|
|
+ Method JoyZDir:Int( port:Int=0 ) Override
|
|
|
Local t#=JoyZ( port )
|
|
|
If t<.333333 Return -1
|
|
|
If t>.333333 Return 1
|
|
|
Return 0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyUDir:Int( port:Int=0 )
|
|
|
+ Method JoyUDir:Int( port:Int=0 ) Override
|
|
|
Local t#=JoyU( port )
|
|
|
If t<.333333 Return -1
|
|
|
If t>.333333 Return 1
|
|
|
Return 0
|
|
|
End Method
|
|
|
|
|
|
- Method JoyVDir:Int( port:Int=0 )
|
|
|
+ Method JoyVDir:Int( port:Int=0 ) Override
|
|
|
Local t#=JoyV( port )
|
|
|
If t<.333333 Return -1
|
|
|
If t>.333333 Return 1
|
|
|
Return 0
|
|
|
End Method
|
|
|
|
|
|
- Method FlushJoy( port_mask:Int=~0 )
|
|
|
+ Method FlushJoy( port_mask:Int=~0 ) Override
|
|
|
' TODO ?
|
|
|
End Method
|
|
|
|