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
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PythonMouse.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_PythonMouse.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
index ccbac882c96..b2bb68f020e 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp
@@ -112,10 +112,15 @@ 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);
+ float x_coord, y_coord;
+
+ x_coord = self->m_canvas->GetMouseNormalizedX(xevent.m_eventval);
+ y_coord = self->m_canvas->GetMouseNormalizedY(yevent.m_eventval);
+
PyObject* ret = PyTuple_New(2);
- 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()));
+ PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(x_coord));
+ PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(y_coord));
return ret;
}