Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-04-17 23:05:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-04-17 23:05:53 +0400
commit4cf697de8913e91e9091a12afbd37f5ebd4c9940 (patch)
tree3ab3ea56d24c12abfcb9dd027b8a917f2bff639b /source
parent392e1da1790d252f0f156379c1d5507959a4e17a (diff)
- for BGE mouse and keyboard events use tuples rather then lists
- pep8 corrections
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.cpp6
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.cpp15
2 files changed, 10 insertions, 11 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
index ef6d2ad8cab..ddac506e679 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
@@ -102,9 +102,9 @@ PyObject* SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBU
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
{
- PyObject* keypair = PyList_New(2);
- PyList_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
- PyList_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
+ PyObject* keypair = PyTuple_New(2);
+ PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
+ PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
PyList_Append(resultlist, keypair);
}
}
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
index 405c4110301..0da99f40ca9 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
@@ -107,9 +107,9 @@ PyObject* SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_
if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
{
- PyObject* keypair = PyList_New(2);
- PyList_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
- PyList_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
+ PyObject* keypair = PyTuple_New(2);
+ PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i));
+ PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status));
PyList_Append(resultlist, keypair);
}
}
@@ -123,13 +123,12 @@ PyObject* SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUT
const SCA_InputEvent & xevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
const SCA_InputEvent & yevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
- PyObject* resultlist = PyList_New(2);
+ PyObject* ret = PyTuple_New(2);
- PyList_SET_ITEM(resultlist, 0, PyFloat_FromDouble(float(xevent.m_eventval)/self->m_canvas->GetWidth()));
-
- PyList_SET_ITEM(resultlist, 1, PyFloat_FromDouble(float(yevent.m_eventval)/self->m_canvas->GetHeight()));
+ PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(float(xevent.m_eventval)/self->m_canvas->GetWidth()));
+ PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(float(yevent.m_eventval)/self->m_canvas->GetHeight()));
- return resultlist;
+ return ret;
}
int SCA_PythonMouse::pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)