Module SCA_JoystickSensor
|
|
1
2
3 from SCA_ISensor import *
4
6 """
7 This sensor detects player joystick events.
8 """
9
11 """
12 Returns the joystick index to use (from 1 to 8).
13 @rtype: integer
14 """
16 """
17 Sets the joystick index to use.
18 @param index: The index of this joystick sensor, Clamped between 1 and 8.
19 @type index: integer
20 @note: This is only useful when you have more then 1 joystick connected to your computer - multiplayer games.
21 """
23 """
24 Returns the current axis this sensor reacts to. See L{getAxisValue()<SCA_JoystickSensor.getAxisValue>} for the current axis state.
25 @rtype: list
26 @return: 2 values returned are [axisIndex, axisDirection] - see L{setAxis()<SCA_JoystickSensor.setAxis>} for their purpose.
27 @note: When the "All Events" toggle is set, this option has no effect.
28 """
29 - def setAxis(axisIndex, axisDirection):
30 """
31 @param axisIndex: Set the axis index to use when detecting axis movement.
32 @type axisIndex: integer from 1 to 2
33 @param axisDirection: Set the axis direction used for detecting motion. 0:right, 1:up, 2:left, 3:down.
34 @type axisDirection: integer from 0 to 3
35 @note: When the "All Events" toggle is set, this option has no effect.
36 """
38 """
39 Returns the state of the joysticks axis. See differs to L{getAxis()<SCA_JoystickSensor.getAxis>} returning the current state of the joystick.
40 @rtype: list
41 @return: 4 values, each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
42
43 The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
44
45 left:[-32767, 0, ...], right:[32767, 0, ...], up:[0, -32767, ...], down:[0, 32767, ...]
46 @note: Some gamepads only set the axis on and off like a button.
47 """
49 """
50 Get the axis threshold. See L{setThreshold()<SCA_JoystickSensor.setThreshold>} for details.
51 @rtype: integer
52 """
54 """
55 Set the axis threshold.
56 @param threshold: Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive.
57 @type threshold: integer
58 """
76 """
77 Returns the current hat direction this sensor is set to.
78 [hatNumber, hatDirection].
79 @rtype: list
80 @note: When the "All Events" toggle is set, this option has no effect.
81 """
83 """
84 Sets the hat index the sensor reacts to when the "All Events" option is not set.
85 @type index: integer
86 """
88 """
89 Returns the number of axes for the joystick at this index.
90 @rtype: integer
91 """
98 """
99 Returns the number of hats for the joystick at this index.
100 @rtype: integer
101 """
103 """
104 Returns True if a joystick is detected at this joysticks index.
105 @rtype: bool
106 """
107