Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SCA_JoystickSensor.py « PyDoc « gameengine « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1dab9afcaf54b9ad00eb128afa8de35d333712e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# $Id: SCA_RandomSensor.py 15444 2008-07-05 17:05:05Z lukep $
# Documentation for SCA_RandomSensor
from SCA_ISensor import *

class SCA_JoystickSensor(SCA_ISensor):
	"""
	This sensor detects player joystick events.
	"""
	
	def getIndex():
		"""
		Returns the joystick index to use (from 1 to 8).
		@rtype: integer
		"""
	def setIndex(index):
		"""
		Sets the joystick index to use. 
		@param index: The index of this joystick sensor, Clamped between 1 and 8.
		@type index: integer
		@note: This is only useful when you have more then 1 joystick connected to your computer - multiplayer games.
		"""
	def getAxis():
		"""
		Returns the current axis this sensor reacts to. See L{getAxisValue()<SCA_JoystickSensor.getAxisValue>} for the current axis state.
		@rtype: list
		@return: 2 values returned are [axisIndex, axisDirection] - see L{setAxis()<SCA_JoystickSensor.setAxis>} for their purpose.
		@note: When the "All Events" toggle is set, this option has no effect.
		"""
	def setAxis(axisIndex, axisDirection):
		"""
		@param axisIndex: Set the axis index to use when detecting axis movement.
		@type axisIndex: integer from 1 to 2
		@param axisDirection: Set the axis direction used for detecting motion. 0:right, 1:up, 2:left, 3:down.
		@type axisDirection: integer from 0 to 3
		@note: When the "All Events" toggle is set, this option has no effect.
		"""
	def getAxisValue():
		"""
		Returns the state of the joysticks axis. See differs to L{getAxis()<SCA_JoystickSensor.getAxis>} returning the current state of the joystick.
		@rtype: list
		@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. 

			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.

			left:[-32767, 0, ...], right:[32767, 0, ...], up:[0, -32767, ...], down:[0, 32767, ...]
		@note: Some gamepads only set the axis on and off like a button.
		"""
	def getThreshold():
		"""
		Get the axis threshold. See L{setThreshold()<SCA_JoystickSensor.setThreshold>} for details.
		@rtype: integer
		"""
	def setThreshold(threshold):
		"""
		Set the axis threshold.
		@param threshold: Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive.
		@type threshold: integer
		"""
	def getButton():
		"""
		Returns the button index the sensor reacts to. See L{getButtonValue()<SCA_JoystickSensor.getButtonValue>} for a list of pressed buttons.
		@rtype: integer
		@note: When the "All Events" toggle is set, this option has no effect.
		"""
	def setButton(index):
		"""
		Sets the button index the sensor reacts to when the "All Events" option is not set.
		@note: When the "All Events" toggle is set, this option has no effect.
		"""
	def getButtonValue():
		"""
		Returns a list containing the indicies of the currently pressed buttons.
		@rtype: list
		"""
	def getHat():
		"""
		Returns the current hat direction this sensor is set to.
		[hatNumber, hatDirection].
		@rtype: list
		@note: When the "All Events" toggle is set, this option has no effect.
		"""
	def setHat(index):
		"""
		Sets the hat index the sensor reacts to when the "All Events" option is not set.
		@type index: integer
		"""
	def getNumAxes():
		"""
		Returns the number of axes for the joystick at this index.
		@rtype: integer
		"""
	def getNumButtons():
		"""
		Returns the number of buttons for the joystick at this index.
		@rtype: integer
		"""
	def getNumHats():
		"""
		Returns the number of hats for the joystick at this index.
		@rtype: integer
		"""
	def isConnected():
		"""
		Returns True if a joystick is detected at this joysticks index.
		@rtype: bool
		"""