diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-13 14:51:23 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-13 14:51:23 (GMT) |
| commit | cd03297086068345426db1377d2b28029025b802 (patch) | |
| tree | ad62dcfc19e76ac93aeb4071c127dcc1c9204261 /src/interface/Engine.cpp | |
| parent | 03e40d53bc8bdfc23ec9dfd86c516df3cf26024d (diff) | |
| download | powder-cd03297086068345426db1377d2b28029025b802.zip powder-cd03297086068345426db1377d2b28029025b802.tar.gz | |
Mouse move on exiting Window. Fixes 181
Diffstat (limited to 'src/interface/Engine.cpp')
| -rw-r--r-- | src/interface/Engine.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/interface/Engine.cpp b/src/interface/Engine.cpp index 044b5e5..aabbc62 100644 --- a/src/interface/Engine.cpp +++ b/src/interface/Engine.cpp @@ -22,6 +22,7 @@ Engine::Engine(): mouseyp_(0), FpsLimit(60.0f), windows(stack<Window*>()), + mousePositions(stack<Point>()), lastBuffer(NULL), prevBuffers(stack<pixel*>()), windowTargetPosition(0, 0), @@ -98,6 +99,7 @@ void Engine::ShowWindow(Window * window) #endif windows.push(state_); + mousePositions.push(ui::Point(mousex_, mousey_)); } if(state_) state_->DoBlur(); @@ -125,6 +127,17 @@ void Engine::CloseWindow() if(state_) state_->DoFocus(); + + ui::Point mouseState = mousePositions.top(); + mousePositions.pop(); + if(state_) + { + mousexp_ = mouseState.X; + mouseyp_ = mouseState.Y; + state_->DoMouseMove(mousex_, mousey_, mousex_ - mousexp_, mousey_ - mouseyp_); + mousexp_ = mousex_; + mouseyp_ = mousey_; + } } else { |
