diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-01-02 20:43:56 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-01-02 20:43:56 +0300 |
commit | cc569504d0468ec19a1018ea804aa418c134cb0f (patch) | |
tree | 732f5d6fe3d742f63dae5f6e899aea566ae52b0f /source/gameengine/GameLogic/SCA_JoystickSensor.cpp | |
parent | abd4934d1aeceafaa2fc242f00db0ba53a7e24db (diff) |
BGE API Cleanup: update the python attribute definition framework.
* Value clamping to min/max is now supported as an option for integer, float
and string attribute (for string clamping=trim to max length)
* Post check function now take PyAttributeDef parameter so that more
generic function can be written.
* Definition of SCA_ILogicBrick::CheckProperty() function to check that
a string attribute contains a valid property name of the parent game object.
* Definition of enum attribute vi KX_PYATTRIBUTE_ENUM... macros.
Enum are handled just like integer but to be totally paranoid, the sizeof()
of the enum member is check at run time to match integer size.
* More bricks updated to use the framework.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_JoystickSensor.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index ce9058448ac..694bca9bac5 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -328,11 +328,11 @@ PyMethodDef SCA_JoystickSensor::Methods[] = { }; PyAttributeDef SCA_JoystickSensor::Attributes[] = { - KX_PYATTRIBUTE_SHORT_RW("index",0,JOYINDEX_MAX-1,SCA_JoystickSensor,m_joyindex), - KX_PYATTRIBUTE_INT_RW("threshold",0,32768,SCA_JoystickSensor,m_precision), - KX_PYATTRIBUTE_INT_RW("button",0,100,SCA_JoystickSensor,m_button), - KX_PYATTRIBUTE_INT_ARRAY_RW_CHECK("axis",0,3,SCA_JoystickSensor,m_axis,2,CheckAxis), - KX_PYATTRIBUTE_INT_ARRAY_RW_CHECK("hat",0,12,SCA_JoystickSensor,m_hat,2,CheckHat), + KX_PYATTRIBUTE_SHORT_RW("index",0,JOYINDEX_MAX-1,true,SCA_JoystickSensor,m_joyindex), + KX_PYATTRIBUTE_INT_RW("threshold",0,32768,true,SCA_JoystickSensor,m_precision), + KX_PYATTRIBUTE_INT_RW("button",0,100,false,SCA_JoystickSensor,m_button), + KX_PYATTRIBUTE_INT_ARRAY_RW_CHECK("axis",0,3,true,SCA_JoystickSensor,m_axis,2,CheckAxis), + KX_PYATTRIBUTE_INT_ARRAY_RW_CHECK("hat",0,12,true,SCA_JoystickSensor,m_hat,2,CheckHat), // dummy attributes will just be read-only in _setattr // you still need to defined them in _getattr KX_PYATTRIBUTE_DUMMY("axisPosition"), |