1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#include "animpoint.h"
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 (animated != other.animated ) return false;
return true;
}
void AnimPoint::init ()
{
animated=false;
}
void AnimPoint::copy (AnimPoint other)
{
setX (other.x() );
setY (other.x() );
animated=other.animated;
}
void AnimPoint::setDest(const QPointF &p)
{
destPos=p;
}
void AnimPoint::setAnimated(bool b)
{
animated=b;
}
bool AnimPoint::isAnimated()
{
return animated;
}
void AnimPoint::animate()
{
setX (x()+1);
setY (y()+1);
}
|