Difference between revisions of "Joystick"

From Vendetta Lua
Jump to: navigation, search
(New page: == Functions == === SetJoystickSingleAxisSaturation === '''Definition:'''<br> SetJoystickSingleAxisSaturation() -> ? <br><br> '''Description:''' <br> <br><br> '''Arguments:''' <br> ? <br>...)
 
m (Added to category.)
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
== Functions ==
 
== Functions ==
=== SetJoystickSingleAxisSaturation ===
+
 
 +
=== GetJoystickAxisBind ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
SetJoystickSingleAxisSaturation() -> ?
+
GetJoystickAxisBind(joyindex, axisindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
  
<br><br>
 
 
'''Arguments:'''
 
'''Arguments:'''
 
<br>
 
<br>
?
 
<br><br>
 
 
'''Returns:'''
 
'''Returns:'''
 
<br>
 
<br>
 
?
 
?
<br><br>
+
<br>
 
'''Example:'''
 
'''Example:'''
 
<br><br>
 
<br><br>
Line 20: Line 18:
  
  
=== ScanForJoysticks ===
+
=== GetJoystickAxisInvert ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
ScanForJoysticks() -> ?
+
GetJoystickAxisInvert(joyindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 29: Line 27:
 
'''Arguments:'''
 
'''Arguments:'''
 
<br>
 
<br>
?
+
<br>
<br><br>
+
 
'''Returns:'''
 
'''Returns:'''
 
<br>
 
<br>
Line 40: Line 37:
  
  
=== GetJoystickSinglePOVValue ===
+
=== GetJoystickData ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSinglePOVValue() -> ?
+
GetJoystickData(int joyindex) -> table joyinfo
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
 +
<br>
  
 +
'''Arguments:'''<br>
 +
 +
int joyindex - index of the joystick, starts at 0
 
<br><br>
 
<br><br>
'''Arguments:'''
+
 
<br>
+
 
?
+
<br><br>
+
 
'''Returns:'''
 
'''Returns:'''
 
<br>
 
<br>
?
+
 
<br><br>
+
'''joyinfo''' - table with joystick information:<br>
 +
joyinfo[axisindex] - values for each axis, indicies start at 1<br>
 +
joyinfo.Name - name of joystick shown in options<br>
 +
joyinfo.AxisNames - table with names of axis<br>
 +
joyinfo.Buttons - table with state of buttons (i get 128 for pressed, 0 for released)<br>
 +
joyinfo.index - joyindex<br>
 +
joyinfo.POV - table with state of POV switches, -1 for center, otherwise angle, (i get 0 for upwards, 90 for right, etc.)<br>
 +
 
 +
<br>
 
'''Example:'''
 
'''Example:'''
 
<br><br>
 
<br><br>
  
 
+
=== GetJoystickNumAxes ===
 
+
=== GetJoystickSingleAxisRawValue ===
+
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSingleAxisRawValue() -> ?
+
GetJoystickNumAxes(joyindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 69: Line 74:
 
'''Arguments:'''
 
'''Arguments:'''
 
<br>
 
<br>
?
+
<br>
<br><br>
+
 
'''Returns:'''
 
'''Returns:'''
 
<br>
 
<br>
 
?
 
?
<br><br>
+
<br>
 
'''Example:'''
 
'''Example:'''
 
<br><br>
 
<br><br>
Line 80: Line 84:
  
  
=== GetJoystickData ===
+
=== GetJoystickNumButtons ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickData() -> ?
+
GetJoystickNumButtons(joyindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 88: Line 92:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
Line 100: Line 102:
  
  
=== GetJoystickSingleButtonValue ===
+
=== GetJoystickNumPOVs ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSingleButtonValue() -> ?
+
GetJoystickNumPOVs(joyindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 108: Line 110:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
Line 119: Line 119:
  
  
 
+
=== GetJoystickSingleAxisCenter ===
=== GetJoystickAxisInvert ===
+
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickAxisInvert() -> ?
+
GetJoystickSingleAxisCenter(joyindex, axisindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 128: Line 127:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
Line 139: Line 136:
  
  
 
+
=== GetJoystickSingleAxisDeadZone ===
=== SetJoystickSingleAxisCenter ===
+
 
'''Definition:'''<br>
 
'''Definition:'''<br>
SetJoystickSingleAxisCenter() -> ?
+
GetJoystickSingleAxisDeadZone(joyindex, axisindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 148: Line 144:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
Line 157: Line 151:
 
'''Example:'''
 
'''Example:'''
 
<br><br>
 
<br><br>
 
  
  
 
=== GetJoystickSingleAxisInvert ===
 
=== GetJoystickSingleAxisInvert ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSingleAxisInvert() -> ?
+
GetJoystickSingleAxisInvert(joyindex, axisindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 168: Line 161:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
Line 180: Line 171:
  
  
=== GetJoystickSingleAxisValue ===
+
=== GetJoystickSingleAxisRawValue ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSingleAxisValue() -> ?
+
GetJoystickSingleAxisRawValue(joyindex, axisindex) -> int value
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 188: Line 179:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
 
<br>
 
<br>
?
+
'''value''' - position of the joystick in -1000 to 1000 range
 
<br><br>
 
<br><br>
 
'''Example:'''
 
'''Example:'''
Line 200: Line 189:
  
  
=== GetJoystickNumButtons ===
+
=== GetJoystickSingleAxisSaturation ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickNumButtons() -> ?
+
GetJoystickSingleAxisSaturation(joyindex, axisindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 219: Line 208:
  
  
 
+
=== GetJoystickSingleAxisSettings ===
=== SetJoystickSingleAxisDeadZone ===
+
 
'''Definition:'''<br>
 
'''Definition:'''<br>
SetJoystickSingleAxisDeadZone() -> ?
+
GetJoystickSingleAxisSettings(joyindex, axisindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 228: Line 216:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
+
 
?
+
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
Line 239: Line 226:
  
  
 
+
=== GetJoystickSingleAxisValue ===
=== GetJoystickAxisBind ===
+
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickAxisBind() -> ?
+
GetJoystickSingleAxisValue(joyindex, axisindex) -> int value
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 249: Line 235:
 
'''Arguments:'''
 
'''Arguments:'''
 
<br>
 
<br>
?
+
<br>
<br><br>
+
 
'''Returns:'''
 
'''Returns:'''
 
<br>
 
<br>
?
+
'''value''' - position of the joystick in -1000 to 1000 range (for me it's same as raw value)
 
<br><br>
 
<br><br>
 
'''Example:'''
 
'''Example:'''
Line 260: Line 245:
  
  
=== GetJoystickNumAxes ===
+
=== GetJoystickSingleButtonValue ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickNumAxes() -> ?
+
GetJoystickSingleButtonValue(joyindex, buttonindex) -> int buttonstate
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 268: Line 253:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
 
<br>
 
<br>
?
+
'''buttonstate''' - state of the button (for me 0 - not pressed, 128 - pressed)
 
<br><br>
 
<br><br>
 
'''Example:'''
 
'''Example:'''
Line 280: Line 263:
  
  
=== GetJoystickNumPOVs ===
+
=== GetJoystickSinglePOVValue ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickNumPOVs() -> ?
+
GetJoystickSinglePOVValue(joyindex, povindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 289: Line 272:
 
'''Arguments:'''
 
'''Arguments:'''
 
<br>
 
<br>
?
+
<br>
<br><br>
+
 
'''Returns:'''
 
'''Returns:'''
 
<br>
 
<br>
Line 300: Line 282:
  
  
=== GetJoystickSingleAxisSettings ===
+
=== ScanForJoysticks ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSingleAxisSettings() -> ?
+
ScanForJoysticks() -> nil
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
 
+
Detects connected joysticks
<br><br>
+
'''Arguments:'''
+
<br>
+
?
+
<br><br>
+
'''Returns:'''
+
<br>
+
?
+
<br><br>
+
'''Example:'''
+
 
<br><br>
 
<br><br>
  
 
+
=== SetJoystickSingleAxisCenter ===
 
+
=== GetJoystickSingleAxisCenter ===
+
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSingleAxisCenter() -> ?
+
SetJoystickSingleAxisCenter(joyindex, axisindex, value) -> nil
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 328: Line 298:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
<br><br>
 
'''Returns:'''
 
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Example:'''
 
'''Example:'''
Line 340: Line 304:
  
  
=== GetJoystickSingleAxisSaturation ===
+
=== SetJoystickSingleAxisDeadZone ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSingleAxisSaturation() -> ?
+
joystick.SetJoystickSingleAxisDeadZone(joyindex, axisindex, leftdeadzone, rightdeadzone) -> nil
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 348: Line 312:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
<br><br>
 
'''Returns:'''
 
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Example:'''
 
'''Example:'''
Line 360: Line 318:
  
  
=== GetJoystickSingleAxisDeadZone ===
+
 
 +
=== SetJoystickSingleAxisInvert ===
 
'''Definition:'''<br>
 
'''Definition:'''<br>
GetJoystickSingleAxisDeadZone() -> ?
+
SetJoystickSingleAxisInvert(joyindex, axisindex) -> ?
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 368: Line 327:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
 
<br><br>
 
<br><br>
 
'''Returns:'''
 
'''Returns:'''
Line 379: Line 336:
  
  
 
+
=== SetJoystickSingleAxisSaturation ===
=== SetJoystickSingleAxisInvert ===
+
 
'''Definition:'''<br>
 
'''Definition:'''<br>
SetJoystickSingleAxisInvert() -> ?
+
joystick.SetJoystickSingleAxisSaturation(joyindex, axisindex, leftsat, rightsat) -> nil
 
<br><br>
 
<br><br>
 
'''Description:''' <br>
 
'''Description:''' <br>
Line 388: Line 344:
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
<br>
 
?
 
<br><br>
 
'''Returns:'''
 
<br>
 
?
 
 
<br><br>
 
<br><br>
 +
 
'''Example:'''
 
'''Example:'''
 
<br><br>
 
<br><br>
 +
 +
 +
[[Category:Tables]]

Latest revision as of 22:52, 16 June 2009

Functions

GetJoystickAxisBind

Definition:
GetJoystickAxisBind(joyindex, axisindex) -> ?

Description:

Arguments:
Returns:
?
Example:


GetJoystickAxisInvert

Definition:
GetJoystickAxisInvert(joyindex) -> ?

Description:



Arguments:

Returns:
?

Example:


GetJoystickData

Definition:
GetJoystickData(int joyindex) -> table joyinfo

Description:

Arguments:

int joyindex - index of the joystick, starts at 0


Returns:

joyinfo - table with joystick information:
joyinfo[axisindex] - values for each axis, indicies start at 1
joyinfo.Name - name of joystick shown in options
joyinfo.AxisNames - table with names of axis
joyinfo.Buttons - table with state of buttons (i get 128 for pressed, 0 for released)
joyinfo.index - joyindex
joyinfo.POV - table with state of POV switches, -1 for center, otherwise angle, (i get 0 for upwards, 90 for right, etc.)


Example:

GetJoystickNumAxes

Definition:
GetJoystickNumAxes(joyindex) -> ?

Description:



Arguments:

Returns:
?
Example:


GetJoystickNumButtons

Definition:
GetJoystickNumButtons(joyindex) -> ?

Description:



Arguments:

Returns:
?

Example:


GetJoystickNumPOVs

Definition:
GetJoystickNumPOVs(joyindex) -> ?

Description:



Arguments:

Returns:
?

Example:


GetJoystickSingleAxisCenter

Definition:
GetJoystickSingleAxisCenter(joyindex, axisindex) -> ?

Description:



Arguments:

Returns:
?

Example:


GetJoystickSingleAxisDeadZone

Definition:
GetJoystickSingleAxisDeadZone(joyindex, axisindex) -> ?

Description:



Arguments:

Returns:
?

Example:


GetJoystickSingleAxisInvert

Definition:
GetJoystickSingleAxisInvert(joyindex, axisindex) -> ?

Description:



Arguments:

Returns:
?

Example:


GetJoystickSingleAxisRawValue

Definition:
GetJoystickSingleAxisRawValue(joyindex, axisindex) -> int value

Description:



Arguments:

Returns:
value - position of the joystick in -1000 to 1000 range

Example:


GetJoystickSingleAxisSaturation

Definition:
GetJoystickSingleAxisSaturation(joyindex, axisindex) -> ?

Description:



Arguments:
?

Returns:
?

Example:


GetJoystickSingleAxisSettings

Definition:
GetJoystickSingleAxisSettings(joyindex, axisindex) -> ?

Description:



Arguments:



Returns:
?

Example:


GetJoystickSingleAxisValue

Definition:
GetJoystickSingleAxisValue(joyindex, axisindex) -> int value

Description:



Arguments:

Returns:
value - position of the joystick in -1000 to 1000 range (for me it's same as raw value)

Example:


GetJoystickSingleButtonValue

Definition:
GetJoystickSingleButtonValue(joyindex, buttonindex) -> int buttonstate

Description:



Arguments:

Returns:
buttonstate - state of the button (for me 0 - not pressed, 128 - pressed)

Example:


GetJoystickSinglePOVValue

Definition:
GetJoystickSinglePOVValue(joyindex, povindex) -> ?

Description:



Arguments:

Returns:
?

Example:


ScanForJoysticks

Definition:
ScanForJoysticks() -> nil

Description:
Detects connected joysticks

SetJoystickSingleAxisCenter

Definition:
SetJoystickSingleAxisCenter(joyindex, axisindex, value) -> nil

Description:



Arguments:

Example:


SetJoystickSingleAxisDeadZone

Definition:
joystick.SetJoystickSingleAxisDeadZone(joyindex, axisindex, leftdeadzone, rightdeadzone) -> nil

Description:



Arguments:

Example:



SetJoystickSingleAxisInvert

Definition:
SetJoystickSingleAxisInvert(joyindex, axisindex) -> ?

Description:



Arguments:

Returns:
?

Example:


SetJoystickSingleAxisSaturation

Definition:
joystick.SetJoystickSingleAxisSaturation(joyindex, axisindex, leftsat, rightsat) -> nil

Description:



Arguments:

Example: