BGE Fix: [#19951] mouse over sensor is broken with letterboxing framing
Tested with GameLogic.mouse.position and mouse over sensor. It should be working with other mouse sensor as well. If not, please help to test and report a bug. (couldn't test blenderplayer but it should be working there as well). (Benoit, this is the same patch that I sent you. I hope it's OOP enough. Looking forward to hear from you on that) I believe that this was the last "mouse" related bug we had reported. MouseLoook scripts should be working 100% in Blender/BGE 2.50 now \o/
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user