diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-04-24 02:48:26 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-04-24 02:48:26 +0400 |
commit | edc56fae1830047218d2d1d6538765ae02806d7e (patch) | |
tree | cbbd7ab879b5ef7090e782c019458d0eaf75b716 /source/gameengine/GameLogic/SCA_MouseManager.cpp | |
parent | 62c0ac2dc9462b1e6e6b8b271cbcd100886a83e9 (diff) |
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/
Diffstat (limited to 'source/gameengine/GameLogic/SCA_MouseManager.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_MouseManager.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.cpp b/source/gameengine/GameLogic/SCA_MouseManager.cpp index 19d7422df1d..f7f9a566c8d 100644 --- a/source/gameengine/GameLogic/SCA_MouseManager.cpp +++ b/source/gameengine/GameLogic/SCA_MouseManager.cpp @@ -40,12 +40,15 @@ #include "SCA_MouseManager.h" #include "SCA_MouseSensor.h" #include "IntValue.h" +#include "RAS_ICanvas.h" SCA_MouseManager::SCA_MouseManager(SCA_LogicManager* logicmgr, - SCA_IInputDevice* mousedev) + SCA_IInputDevice* mousedev, + RAS_ICanvas* canvas) : SCA_EventManager(logicmgr, MOUSE_EVENTMGR), - m_mousedevice (mousedev) + m_mousedevice (mousedev), + m_canvas(canvas) { m_xpos = 0; m_ypos = 0; @@ -78,12 +81,13 @@ void SCA_MouseManager::NextFrame() // coordinates if (!mousesensor->IsSuspended()) { - const SCA_InputEvent& event = + const SCA_InputEvent& event1 = m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEX); - int mx = event.m_eventval; const SCA_InputEvent& event2 = m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEY); - int my = event2.m_eventval; + + int mx = this->m_canvas->GetMouseX(event1.m_eventval); + int my = this->m_canvas->GetMouseY(event2.m_eventval); mousesensor->setX(mx); mousesensor->setY(my); |