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/PyDoc | |
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/PyDoc')
-rw-r--r-- | source/gameengine/PyDoc/bge.types.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst index 028b4fa72f3..96ba8d278f1 100644 --- a/source/gameengine/PyDoc/bge.types.rst +++ b/source/gameengine/PyDoc/bge.types.rst @@ -71,9 +71,9 @@ Game Engine bge.types Module .. attribute:: events - A list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). + A dictionary containing the status of each keyboard event or key. (read-only). - :type: list [[:ref:`keycode<keyboard-keys>`, :ref:`status<input-status>`], ...] + :type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...} .. class:: SCA_PythonMouse(PyObjectPlus) @@ -81,9 +81,9 @@ Game Engine bge.types Module .. attribute:: events - a list of pressed buttons that have either been pressed, or just released, or are active this frame. (read-only). + a dictionary containing the status of each mouse event. (read-only). - :type: list [[:ref:`keycode<mouse-keys>`, :ref:`status<input-status>`], ...] + :type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...} .. attribute:: position |