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).
This commit is contained in:
@@ -66,6 +66,12 @@ Game Types (bge.types)
|
||||
|
||||
:type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...}
|
||||
|
||||
.. attribute:: active_events
|
||||
|
||||
A dictionary containing the status of only the active keyboard events or keys. (read-only).
|
||||
|
||||
:type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-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<mouse-keys>`::ref:`status<input-status>`, ...}
|
||||
|
||||
.. attribute:: active_events
|
||||
|
||||
a dictionary containing the status of only the active mouse events. (read-only).
|
||||
|
||||
:type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...}
|
||||
|
||||
.. attribute:: position
|
||||
|
||||
|
Reference in New Issue
Block a user