diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2010-08-30 04:18:50 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2010-08-30 04:18:50 +0400 |
commit | 57e0d677c6b935950051748713788c6532c972fa (patch) | |
tree | 24d1c1505ad99995ec5ed3596d6d74d3723c6d0a /source/gameengine/GameLogic/SCA_PythonKeyboard.h | |
parent | cb786f0022984705701f0bf5428706f16d8a1a31 (diff) |
Committing patch [#23489] add method getEventStatus() to PythonKeyboard and PythonMouse by Geoff Gollmer (gomer)
This patch makes SCA_PythonKeyboard.events and SCA_PythonMouse.events return a dictionary of all inputs (including inactive) instead of a list of active inputs.
Example usage:
import bge
if bge.logic.keyboard.events[bge.events.SPACEBAR] = bge.logic.KX_INPUT_JUST_ACTIVATED:
print("Spacebar pressed!")
A couple of changes to the patch:
* Wrap python stuff in #ifndef DISABLE_PYTHON
* Clear and decref m_event_dict in the destructors
A couple of things not related to the patch:
* Made member variables private
* Removed a commented out (and no longer used) method (SCA_PythonMouse.show())
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PythonKeyboard.h')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PythonKeyboard.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h index 0b353ac444c..260835155e6 100644 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.h +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.h @@ -30,7 +30,11 @@ class SCA_PythonKeyboard : public PyObjectPlus { Py_Header; +private: class SCA_IInputDevice *m_keyboard; +#ifndef DISABLE_PYTHON + PyObject* m_event_dict; +#endif public: SCA_PythonKeyboard(class SCA_IInputDevice* keyboard); virtual ~SCA_PythonKeyboard(); |