Blender Git Loki

Git Commits -> Revision f2f2b61

Revision f2f2b61 by Mitchell Stokes (master)
December 21, 2012, 02:28 (GMT)
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.

Commit Details:

Full Hash: f2f2b6153a2a818ca940a4df5b7dafc743ef2d2f
SVN Revision: 53223
Parent Commit: 26752e8
Lines Changed: +370, -5

2 Added Paths:

/source/gameengine/GameLogic/SCA_PythonJoystick.cpp (+184, -0) (View)
/source/gameengine/GameLogic/SCA_PythonJoystick.h (+56, -0) (View)

8 Modified Paths:

/doc/python_api/rst/bge.logic.rst (+4, -0) (Diff)
/doc/python_api/rst/bge.types.rst (+70, -2) (Diff)
/source/gameengine/GameLogic/CMakeLists.txt (+2, -0) (Diff)
/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp (+9, -0) (Diff)
/source/gameengine/GameLogic/Joystick/SCA_Joystick.h (+5, -0) (Diff)
/source/gameengine/GameLogic/SCA_JoystickManager.cpp (+5, -3) (Diff)
/source/gameengine/Ketsji/KX_PythonInit.cpp (+33, -0) (Diff)
/source/gameengine/Ketsji/KX_PythonInitTypes.cpp (+2, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021