Mouse move on exiting Window. Fixes 181

This commit is contained in:
Simon Robertshaw 2012-09-13 15:51:23 +01:00
parent 03e40d53bc
commit cd03297086

View File

@ -22,6 +22,7 @@ Engine::Engine():
mouseyp_(0), mouseyp_(0),
FpsLimit(60.0f), FpsLimit(60.0f),
windows(stack<Window*>()), windows(stack<Window*>()),
mousePositions(stack<Point>()),
lastBuffer(NULL), lastBuffer(NULL),
prevBuffers(stack<pixel*>()), prevBuffers(stack<pixel*>()),
windowTargetPosition(0, 0), windowTargetPosition(0, 0),
@ -98,6 +99,7 @@ void Engine::ShowWindow(Window * window)
#endif #endif
windows.push(state_); windows.push(state_);
mousePositions.push(ui::Point(mousex_, mousey_));
} }
if(state_) if(state_)
state_->DoBlur(); state_->DoBlur();
@ -125,6 +127,17 @@ void Engine::CloseWindow()
if(state_) if(state_)
state_->DoFocus(); 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 else
{ {