From: <es...@us...> - 2010-07-18 09:24:42
|
Revision: 2950 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2950&view=rev Author: esuvs Date: 2010-07-18 09:24:36 +0000 (Sun, 18 Jul 2010) Log Message: ----------- Work on mouse handling. Modified Paths: -------------- trunk/QtOgreFramework/EngineTest/include/Mouse.h trunk/QtOgreFramework/EngineTest/source/EngineTestGameLogic.cpp trunk/QtOgreFramework/EngineTest/source/Mouse.cpp Modified: trunk/QtOgreFramework/EngineTest/include/Mouse.h =================================================================== --- trunk/QtOgreFramework/EngineTest/include/Mouse.h 2010-07-18 09:16:23 UTC (rev 2949) +++ trunk/QtOgreFramework/EngineTest/include/Mouse.h 2010-07-18 09:24:36 UTC (rev 2950) @@ -11,28 +11,22 @@ public: Mouse(QObject * parent = 0); - Q_PROPERTY(QPoint position READ position WRITE setPosition) + Q_PROPERTY(QPoint position READ position) Q_PROPERTY(QPoint previousPosition READ previousPosition) public slots: bool isPressed(int mouseButton); - void press(int mouseButton); - void release(int mouseButton); const QPoint& position(void); - void setPosition(const QPoint& pos); const QPoint& previousPosition(void); + void setPreviousPosition(const QPoint& pos); - void resetDelta(void); - void modifyWheelDelta(int wheelDelta); - int getWheelDelta(void); - void resetWheelDelta(void); private: Modified: trunk/QtOgreFramework/EngineTest/source/EngineTestGameLogic.cpp =================================================================== --- trunk/QtOgreFramework/EngineTest/source/EngineTestGameLogic.cpp 2010-07-18 09:16:23 UTC (rev 2949) +++ trunk/QtOgreFramework/EngineTest/source/EngineTestGameLogic.cpp 2010-07-18 09:24:36 UTC (rev 2950) @@ -153,7 +153,8 @@ } } - mouse->resetDelta(); + //mouse->resetDelta(); + mouse->setPreviousPosition(mouse->position()); mouse->resetWheelDelta(); mSceneManager->destroyAllLights(); @@ -197,10 +198,10 @@ void EngineTestGameLogic::onMousePress(QMouseEvent* event) { mouse->press(event->button()); - + //Update the mouse position as well or we get 'jumps' mouse->setPosition(event->pos()); - mouse->resetDelta(); + mouse->setPreviousPosition(mouse->position()); } void EngineTestGameLogic::onMouseRelease(QMouseEvent* event) Modified: trunk/QtOgreFramework/EngineTest/source/Mouse.cpp =================================================================== --- trunk/QtOgreFramework/EngineTest/source/Mouse.cpp 2010-07-18 09:16:23 UTC (rev 2949) +++ trunk/QtOgreFramework/EngineTest/source/Mouse.cpp 2010-07-18 09:24:36 UTC (rev 2950) @@ -51,9 +51,9 @@ return mPreviousPosition; } -void Mouse::resetDelta(void) +void Mouse::setPreviousPosition(const QPoint& pos) { - mPreviousPosition = mPosition; + mPreviousPosition = pos; } void Mouse::modifyWheelDelta(int wheelDelta) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |