1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/animpoint.cpp Wed Apr 25 16:02:54 2007 +0000
1.3 @@ -0,0 +1,70 @@
1.4 +#include "animpoint.h"
1.5 +
1.6 +AnimPoint::AnimPoint()
1.7 +{
1.8 + init();
1.9 +}
1.10 +
1.11 +void AnimPoint::operator= ( const AnimPoint & other )
1.12 +{
1.13 + copy (other);
1.14 +}
1.15 +
1.16 +void AnimPoint::operator= ( const QPointF & other )
1.17 +{
1.18 + init();
1.19 + setX (other.x() );
1.20 + setY (other.x() );
1.21 +}
1.22 +
1.23 +bool AnimPoint::operator== ( const QPointF& other )
1.24 +{
1.25 + QPointF p( x(),y());
1.26 + return p == other;
1.27 +}
1.28 +
1.29 +bool AnimPoint::operator== ( AnimPoint other )
1.30 +{
1.31 + if (rx() != other.rx() ) return false;
1.32 + if (ry() != other.ry() ) return false;
1.33 + if (animated != other.animated ) return false;
1.34 +
1.35 + return true;
1.36 +}
1.37 +
1.38 +void AnimPoint::init ()
1.39 +{
1.40 + animated=false;
1.41 +}
1.42 +
1.43 +void AnimPoint::copy (AnimPoint other)
1.44 +{
1.45 + setX (other.x() );
1.46 + setY (other.x() );
1.47 + animated=other.animated;
1.48 +}
1.49 +
1.50 +
1.51 +void AnimPoint::setDest(const QPointF &p)
1.52 +{
1.53 + destPos=p;
1.54 +}
1.55 +
1.56 +void AnimPoint::setAnimated(bool b)
1.57 +{
1.58 + animated=b;
1.59 +}
1.60 +
1.61 +bool AnimPoint::isAnimated()
1.62 +{
1.63 + return animated;
1.64 +}
1.65 +
1.66 +void AnimPoint::animate()
1.67 +{
1.68 + setX (x()+1);
1.69 + setY (y()+1);
1.70 +}
1.71 +
1.72 +
1.73 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/animpoint.h Wed Apr 25 16:02:54 2007 +0000
2.3 @@ -0,0 +1,29 @@
2.4 +#ifndef ANIMPOINT_H
2.5 +#define ANIMPOINT_H
2.6 +
2.7 +#include <QPointF>
2.8 +
2.9 +class AnimPoint: public QPointF
2.10 +{
2.11 +public:
2.12 + AnimPoint();
2.13 + void operator= ( const AnimPoint & );
2.14 + void operator= ( const QPointF & );
2.15 + bool operator== ( const QPointF & );
2.16 + bool operator== ( AnimPoint );
2.17 + void init();
2.18 + void copy(AnimPoint other);
2.19 + void setDest (const QPointF &);
2.20 + void setAnimated(bool);
2.21 + bool isAnimated ();
2.22 + void animate();
2.23 +
2.24 +private:
2.25 + QPointF currentPos;
2.26 + QPointF destPos;
2.27 + qreal n;
2.28 + bool animated;
2.29 +
2.30 +};
2.31 +
2.32 +#endif