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())
This commit is contained in:
@@ -30,8 +30,12 @@
|
||||
class SCA_PythonMouse : public PyObjectPlus
|
||||
{
|
||||
Py_Header;
|
||||
private:
|
||||
class SCA_IInputDevice *m_mouse;
|
||||
class RAS_ICanvas *m_canvas;
|
||||
#ifndef DISABLE_PYTHON
|
||||
PyObject* m_event_dict;
|
||||
#endif
|
||||
public:
|
||||
SCA_PythonMouse(class SCA_IInputDevice* mouse, class RAS_ICanvas* canvas);
|
||||
virtual ~SCA_PythonMouse();
|
||||
|
||||
Reference in New Issue
Block a user