window move improv

This commit is contained in:
Eduardo Bart 2011-04-17 17:28:12 -03:00
parent f2c187c810
commit 44a7f6ab90
2 changed files with 3 additions and 1 deletions

View File

@ -35,6 +35,7 @@ void UIWindow::onInputEvent(const InputEvent& event)
headRect.setHeight(skin->getHeadHeight());
if(headRect.contains(event.mousePos)) {
m_moving = true;
m_movingReference = event.mousePos - getRect().topLeft();
}
} else if(event.type == EV_MOUSE_LUP) {
if(m_moving) {
@ -42,7 +43,7 @@ void UIWindow::onInputEvent(const InputEvent& event)
}
} else if(event.type == EV_MOUSE_MOVE) {
if(m_moving) {
moveTo(getRect().topLeft() + event.mouseMoved);
moveTo(event.mousePos - m_movingReference);
}
}
}

View File

@ -43,6 +43,7 @@ public:
private:
std::string m_title;
bool m_moving;
Point m_movingReference;
};
typedef boost::shared_ptr<UIWindow> UIWindowPtr;