diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2012-12-21 06:28:59 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2012-12-21 06:28:59 +0400 |
commit | f2f2b6153a2a818ca940a4df5b7dafc743ef2d2f (patch) | |
tree | a6562a6c389b7f3e99461dda1245b1037b78a020 /doc/python_api/rst/bge.logic.rst | |
parent | 26752e8b3a367a7c5161ad7418e910bb2ce6ee5d (diff) |
BGE: Adding a Python interface for handling joysticks without needing logic bricks. These new SCA_PythonJoystick objects can be accessed using bge.logic.joysticks, which is a list of joysticks. The length of the list is the number of maximum supported joysticks, and indexes that do not have a joystick available are set to None. This means joysticks can be checked for using something like:
if bge.logic.joysticks[0]:
activate_player_one()
if bge.logic.joysticks[1]:
activate_player_two()
etc..
The interface exposed by SCA_PythonJoystick is very similar to the joystick logic brick except for one key difference: axis values are normalized to a -1.0 to 1.0 range instead of -32767 to 32767, which is what the logic brick exposed.
Diffstat (limited to 'doc/python_api/rst/bge.logic.rst')
-rw-r--r-- | doc/python_api/rst/bge.logic.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst index 7d20aa31a36..ee39f7659ca 100644 --- a/doc/python_api/rst/bge.logic.rst +++ b/doc/python_api/rst/bge.logic.rst @@ -125,6 +125,10 @@ Variables The current mouse wrapped in an :class:`~bge.types.SCA_PythonMouse` object. +.. data:: joysticks + + A list of attached joysticks. The list size it he maximum number of supported joysticks. If no joystick is available for a given slot, the slot is set to None. + ***************** General functions ***************** |