From 57d48d4493a78d2886f83a28fe66c2654bed4f6c Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 22 Jan 2012 05:45:56 +0000 Subject: Committing patch "[#29763] Adding an active_events property to SCA_PythonKeyboard and SCA_PythonMouse" Here is the description: As the summary says, this patch adds a new event to both SCA_PythonKeyboard and SCA_PythonMouse. This property is similar to the events property that both have, but it only returns events which are not KX_NO_INPUTSTATUS. This moves the "no input" check from Python to C, which gave my input handling code a 2x speed up. Python sucks (performance-wise) with iterating lists and SCA_PythonKeyboard has close to 200 events (I think something like 177, but I don't know for sure). --- doc/python_api/rst/bge.types.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'doc') diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst index bb3ac004d51..6988f90cc1e 100644 --- a/doc/python_api/rst/bge.types.rst +++ b/doc/python_api/rst/bge.types.rst @@ -66,6 +66,12 @@ Game Types (bge.types) :type: dictionary {:ref:`keycode`::ref:`status`, ...} + .. attribute:: active_events + + A dictionary containing the status of only the active keyboard events or keys. (read-only). + + :type: dictionary {:ref:`keycode`::ref:`status`, ...} + .. class:: SCA_PythonMouse(PyObjectPlus) The current mouse. @@ -75,6 +81,12 @@ Game Types (bge.types) a dictionary containing the status of each mouse event. (read-only). :type: dictionary {:ref:`keycode`::ref:`status`, ...} + + .. attribute:: active_events + + a dictionary containing the status of only the active mouse events. (read-only). + + :type: dictionary {:ref:`keycode`::ref:`status`, ...} .. attribute:: position -- cgit v1.2.3