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:
authorDalai Felinto <dfelinto@gmail.com>2010-04-24 02:48:26 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-04-24 02:48:26 +0400
commitedc56fae1830047218d2d1d6538765ae02806d7e (patch)
treecbbd7ab879b5ef7090e782c019458d0eaf75b716 /source/gameengine/GamePlayer
parent62c0ac2dc9462b1e6e6b8b271cbcd100886a83e9 (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/GamePlayer')
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp3
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp10
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Canvas.h4
3 files changed, 16 insertions, 1 deletions
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index 18043849bf3..7c3a6adf881 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -673,7 +673,8 @@ bool GPG_Application::startEngine(void)
m_mouse,
m_networkdevice,
startscenename,
- m_startScene);
+ m_startScene,
+ m_canvas);
#ifndef DISABLE_PYTHON
// some python things
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
index 6b478c1ab4e..24c0102a87c 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
@@ -104,3 +104,13 @@ void GPG_Canvas::SwapBuffers()
m_window->swapBuffers();
}
}
+
+float GPG_Canvas::GetMouseNormalizedX(int x)
+{
+ return float(x)/this->GetWidth();
+}
+
+float GPG_Canvas::GetMouseNormalizedY(int y)
+{
+ return float(y)/this->GetHeight();
+}
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
index 18e58691d2c..7b19c03d3c3 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
@@ -53,6 +53,10 @@ public:
virtual void SetMousePosition(int x, int y);
virtual void SetMouseState(RAS_MouseState mousestate);
virtual void SwapBuffers();
+ virtual int GetMouseX(int x){return x;};
+ virtual int GetMouseY(int y){return y;};
+ virtual float GetMouseNormalizedX(int x);
+ virtual float GetMouseNormalizedY(int y);
bool BeginDraw() { return true;};
void EndDraw() {};