# HG changeset patch # User insilmaril # Date 1218106612 0 # Node ID 326e3336e9b01163eb89c3e7680ea33b58aa0ac9 # Parent 4d441cb0a856a91541c452ee3cd46e7e1d377270 Changed speed of animation a bit diff -r 4d441cb0a856 -r 326e3336e9b0 animpoint.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/animpoint.cpp Thu Aug 07 10:56:52 2008 +0000 @@ -0,0 +1,131 @@ +#include "animpoint.h" + +#include + +AnimPoint::AnimPoint() +{ + init(); +} + +void AnimPoint::operator= ( const AnimPoint & other ) +{ + copy (other); +} + +void AnimPoint::operator= ( const QPointF & other ) +{ + init(); + setX (other.x() ); + setY (other.x() ); +} + +bool AnimPoint::operator== ( const QPointF& other ) +{ + QPointF p( x(),y()); + return p == other; +} + +bool AnimPoint::operator== ( AnimPoint other ) +{ + if (rx() != other.rx() ) return false; + if (ry() != other.ry() ) return false; + if (startPos != other.startPos) return false; + if (destPos != other.destPos) return false; + if (animated != other.animated ) return false; + + return true; +} + +void AnimPoint::init () +{ + animated=false; + n=0; + startPos=QPointF(0,0); + destPos=QPointF(0,0); + vector=QPointF(0,0); + animTicks=10; +} + +void AnimPoint::copy (AnimPoint other) +{ + setX (other.x() ); + setY (other.x() ); + startPos=other.startPos; + destPos=other.destPos; + vector=other.vector; + animated=other.animated; + n=other.n; + animTicks=other.animTicks; +} + +void AnimPoint::setStart(const QPointF &p) +{ + startPos=p; + initVector(); +} + +QPointF AnimPoint::getStart() +{ + return startPos; +} + + +void AnimPoint::setDest(const QPointF &p) +{ + destPos=p; + initVector(); +} + +QPointF AnimPoint::getDest() +{ + return destPos; +} + +void AnimPoint::setTicks (const uint &t) +{ + animTicks=t; +} + +uint AnimPoint::getTicks() +{ + return animTicks; +} + +void AnimPoint::setAnimated(bool b) +{ + animated=b; + if (b) n=0; +} + +bool AnimPoint::isAnimated() +{ + return animated; +} + +bool AnimPoint::animate() +{ + if (!animated) return animated; + n++; + if (n>animTicks) + { + vector=QPointF(0,0); + animated=false; + return animated; + } + + // Some math slow down the movement + qreal f=1-n/animTicks; + qreal ff=1-f*f*f; + setX (startPos.x() + vector.x()*ff ); + setY (startPos.y() + vector.y()*ff ); + + return animated; +} + +void AnimPoint::initVector() +{ + vector.setX (destPos.x()-startPos.x() ); + vector.setY (destPos.y()-startPos.y() ); +} + + diff -r 4d441cb0a856 -r 326e3336e9b0 version.h --- a/version.h Mon Aug 04 06:52:15 2008 +0000 +++ b/version.h Thu Aug 07 10:56:52 2008 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.12.1" #define __VYM_CODENAME "Maintenance Update" //#define __VYM_CODENAME "Codename: development version" -#define __VYM_BUILD_DATE "2008-07-30" +#define __VYM_BUILD_DATE "2008-08-37" bool checkVersion(const QString &);