animpoint.cpp
author insilmaril
Wed, 05 Dec 2007 14:58:03 +0000
changeset 631 ba4a99830ad1
parent 461 b0d72eb511c9
child 688 d0086df58648
permissions -rw-r--r--
Added files from Andrew Ng for Windows
insilmaril@461
     1
#include "animpoint.h"
insilmaril@461
     2
insilmaril@461
     3
AnimPoint::AnimPoint()
insilmaril@461
     4
{
insilmaril@461
     5
	init();
insilmaril@461
     6
}
insilmaril@461
     7
insilmaril@461
     8
void AnimPoint::operator= ( const AnimPoint & other )
insilmaril@461
     9
{
insilmaril@461
    10
	copy (other);
insilmaril@461
    11
}
insilmaril@461
    12
insilmaril@461
    13
void AnimPoint::operator= ( const QPointF & other )
insilmaril@461
    14
{
insilmaril@461
    15
	init();
insilmaril@461
    16
	setX (other.x() );
insilmaril@461
    17
	setY (other.x() );
insilmaril@461
    18
}
insilmaril@461
    19
insilmaril@461
    20
bool AnimPoint::operator== ( const QPointF& other )
insilmaril@461
    21
{
insilmaril@461
    22
	QPointF p( x(),y());
insilmaril@461
    23
	return p == other;
insilmaril@461
    24
}
insilmaril@461
    25
insilmaril@461
    26
bool AnimPoint::operator== ( AnimPoint  other )
insilmaril@461
    27
{
insilmaril@461
    28
    if (rx() != other.rx() ) return false;
insilmaril@461
    29
    if (ry() != other.ry() ) return false;
insilmaril@461
    30
    if (animated != other.animated ) return false;
insilmaril@461
    31
insilmaril@461
    32
	return true;
insilmaril@461
    33
}
insilmaril@461
    34
insilmaril@461
    35
void AnimPoint::init ()
insilmaril@461
    36
{
insilmaril@461
    37
	animated=false;
insilmaril@461
    38
}
insilmaril@461
    39
insilmaril@461
    40
void AnimPoint::copy (AnimPoint other)
insilmaril@461
    41
{
insilmaril@461
    42
	setX (other.x() );
insilmaril@461
    43
	setY (other.x() );
insilmaril@461
    44
	animated=other.animated;
insilmaril@461
    45
}
insilmaril@461
    46
insilmaril@461
    47
insilmaril@461
    48
void AnimPoint::setDest(const QPointF &p)
insilmaril@461
    49
{
insilmaril@461
    50
	destPos=p;
insilmaril@461
    51
}
insilmaril@461
    52
insilmaril@461
    53
void AnimPoint::setAnimated(bool b)
insilmaril@461
    54
{
insilmaril@461
    55
	animated=b;
insilmaril@461
    56
}
insilmaril@461
    57
insilmaril@461
    58
bool AnimPoint::isAnimated()
insilmaril@461
    59
{
insilmaril@461
    60
	return animated;
insilmaril@461
    61
}
insilmaril@461
    62
insilmaril@461
    63
void AnimPoint::animate()
insilmaril@461
    64
{
insilmaril@461
    65
	setX (x()+1);
insilmaril@461
    66
	setY (y()+1);
insilmaril@461
    67
}
insilmaril@461
    68
insilmaril@461
    69
insilmaril@461
    70