From 03d5780b76f74f9468d3ec990f1135b6a6db3478 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 18 Oct 2008 13:23:30 +0000 Subject: Added joystick epydocs, only changed incorrect docstrings in SCA_JoystickSensor.cpp patch [#17857] HotKeys Update by dfelinto - SmoothStroke and Anchored. Made own edits, removed videoscape and added curve and armature specials. --- source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 8 +- source/gameengine/PyDoc/GameLogic.py | 61 ++++++------ source/gameengine/PyDoc/SCA_JoystickSensor.py | 106 +++++++++++++++++++++ 3 files changed, 141 insertions(+), 34 deletions(-) create mode 100644 source/gameengine/PyDoc/SCA_JoystickSensor.py (limited to 'source') diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index 3f95037d6e0..d0dc875da0b 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -355,7 +355,7 @@ PyObject* SCA_JoystickSensor::PySetIndex( PyObject* self, PyObject* value ) { /* get axis ---------------------------------------------------------- */ const char SCA_JoystickSensor::GetAxis_doc[] = "getAxis\n" -"\tReturns the current state of the axis.\n"; +"\tReturns the current axis this sensor reacts to.\n"; PyObject* SCA_JoystickSensor::PyGetAxis( PyObject* self) { return Py_BuildValue("[ii]",m_axis, m_axisf); } @@ -364,7 +364,7 @@ PyObject* SCA_JoystickSensor::PyGetAxis( PyObject* self) { /* set axis ---------------------------------------------------------- */ const char SCA_JoystickSensor::SetAxis_doc[] = "setAxis\n" -"\tSets the current state of the axis.\n"; +"\tSets the current axis this sensor reacts to.\n"; PyObject* SCA_JoystickSensor::PySetAxis( PyObject* self, PyObject* args ) { int axis,axisflag; @@ -380,7 +380,7 @@ PyObject* SCA_JoystickSensor::PySetAxis( PyObject* self, PyObject* args ) { /* get axis value ----------------------------------------------------- */ const char SCA_JoystickSensor::GetAxisValue_doc[] = "getAxisValue\n" -"\tReturns a list of the values for each axis .\n"; +"\tReturns a list of the values for the current state of each axis.\n"; PyObject* SCA_JoystickSensor::PyGetAxisValue( PyObject* self) { SCA_Joystick *joy = m_pJoystickMgr->GetJoystickDevice(m_joyindex); if(joy) @@ -437,7 +437,7 @@ PyObject* SCA_JoystickSensor::PySetButton( PyObject* self, PyObject* value ) { /* get button value -------------------------------------------------- */ const char SCA_JoystickSensor::GetButtonValue_doc[] = "getButtonValue\n" -"\tReturns a list containing the indicies of the currently pressed buttons.\n"; +"\tReturns a list containing the indicies of the current pressed state of each button.\n"; PyObject* SCA_JoystickSensor::PyGetButtonValue( PyObject* self) { SCA_Joystick *joy = m_pJoystickMgr->GetJoystickDevice(m_joyindex); PyObject *ls = PyList_New(0); diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py index af3d2810553..9dab7db6081 100644 --- a/source/gameengine/PyDoc/GameLogic.py +++ b/source/gameengine/PyDoc/GameLogic.py @@ -13,10 +13,10 @@ Documentation for the GameLogic Module. See L{WhatsNew} for updates, changes and new functionality in the Game Engine Python API. Examples:: - # To get a controller: + # To get the controller thats running this python script: co = GameLogic.getCurrentController() # GameLogic is automatically imported - # To get the game object associated with this controller: + # To get the game object this controller is on: obj = co.getOwner() L{KX_GameObject} and L{KX_Camera} or L{KX_Light} methods are available depending on the type of object:: @@ -31,17 +31,18 @@ Documentation for the GameLogic Module. sensors = co.getSensors() See the sensor's reference for available methods: - - L{KX_NetworkMessageSensor} - - L{KX_RaySensor} - - L{KX_MouseFocusSensor} - - L{KX_NearSensor} - - L{KX_RadarSensor} - - L{KX_TouchSensor} - - L{SCA_KeyboardSensor} - - L{SCA_MouseSensor} - - L{SCA_PropertySensor} - - L{SCA_RandomSensor} - - L{SCA_DelaySensor} + - L{DelaySensor} + - L{JoystickSensor} + - L{KeyboardSensor} + - L{MouseFocusSensor} + - L{MouseSensor} + - L{NearSensor} + - L{NetworkMessageSensor} + - L{PropertySensor} + - L{RadarSensor} + - L{RandomSensor} + - L{RaySensor} + - L{TouchSensor} You can also access actuators linked to the controller:: # To get an actuator attached to the controller: @@ -54,23 +55,23 @@ Documentation for the GameLogic Module. GameLogic.addActiveActuator(actuator, True) See the actuator's reference for available methods: - - L{BL_ActionActuator} - - L{KX_CameraActuator} - - L{KX_CDActuator} - - L{KX_ConstraintActuator} - - L{KX_GameActuator} - - L{KX_IpoActuator} - - L{KX_NetworkMessageActuator} - - L{KX_ObjectActuator} - - L{KX_SCA_AddObjectActuator} - - L{KX_SCA_EndObjectActuator} - - L{KX_SCA_ReplaceMeshActuator} - - L{KX_SceneActuator} - - L{KX_SoundActuator} - - L{KX_TrackToActuator} - - L{KX_VisibilityActuator} - - L{SCA_PropertyActuator} - - L{SCA_RandomActuator} + - L{ActionActuator} + - L{AddObjectActuator} + - L{CameraActuator} + - L{CDActuator} + - L{ConstraintActuator} + - L{EndObjectActuator} + - L{GameActuator} + - L{IpoActuator} + - L{NetworkMessageActuator} + - L{ObjectActuator} + - L{PropertyActuator} + - L{RandomActuator} + - L{ReplaceMeshActuator} + - L{SceneActuator} + - L{SoundActuator} + - L{TrackToActuator} + - L{VisibilityActuator} Most logic brick's methods are accessors for the properties available in the logic buttons. Consult the logic bricks documentation for more information on how each logic brick works. diff --git a/source/gameengine/PyDoc/SCA_JoystickSensor.py b/source/gameengine/PyDoc/SCA_JoystickSensor.py new file mode 100644 index 00000000000..d1dab9afcaf --- /dev/null +++ b/source/gameengine/PyDoc/SCA_JoystickSensor.py @@ -0,0 +1,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()} for the current axis state. + @rtype: list + @return: 2 values returned are [axisIndex, axisDirection] - see L{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()} 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()} 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()} 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 + """ -- cgit v1.2.3