Entity.cpp

Go to the documentation of this file.
00001 //#include <iostream>
00002 //using namespace std;
00003 
00004 #include "entity.h"
00005 #include "math.h"
00006 
00007 //***********************************************
00008 Entity::Entity( void )
00009 {
00010     //cout << "Entity[" << this << "]" << endl;
00011     // default initialization;
00012     angle = x = y = 0;
00013     color = COLOR_UNKNOWN;
00014     type = TYPE_UNKNOWN;
00015 }
00016 
00017 bool Entity::operator< ( Entity &rhs ) {
00018     
00019 //      return ( (pow(2,x) + pow(2,y)) < (pow(2,rhs.x) + pow(2,rhs.y)) ) ; 
00020   
00021         // only take y, because off perspective this parameter is more important than x
00022         //  scaling factor y versus x unknown -> therefore only look at y
00023         return (y < rhs.y) ;
00024 }
00025 
00026 
00027 //***********************************************
00028 Entity::~Entity( void )
00029 {
00030     //cout << "~Entity[" << this << "]" << endl;
00031 }
00032 
00033 //***********************************************
00034 Entity::Color
00035 Entity::getColor( void )
00036 {
00037     return( color );
00038 }
00039 
00040 //***********************************************
00041 void
00042 Entity::setColor( Color _color )
00043 {
00044     color = _color;
00045 }
00046 
00047 //***********************************************
00048 short 
00049 Entity::getX( void )
00050 {
00051     return( x );
00052 }
00053 
00054 //***********************************************
00055 short 
00056 Entity::getY( void )
00057 {
00058     return( y );
00059 }
00060 
00061 //***********************************************
00062 void
00063 Entity::setX( short _x )
00064 {
00065     x = _x;
00066 }
00067 
00068 //***********************************************
00069 void
00070 Entity::setY( short _y )
00071 {
00072     y = _y;
00073 }
00074 
00075 //***********************************************
00076 short
00077 Entity::getAngle( void )
00078 {
00079     return( angle );
00080 }
00081 
00082 //***********************************************
00083 void
00084 Entity::setAngle( short _angle )
00085 {
00086     angle = _angle;
00087 }
00088 
00089 //***********************************************
00090 void
00091 Entity::setType( Type _type )
00092 {
00093     type = _type;
00094 }
00095 
00096 //***********************************************
00097 Entity::Type
00098 Entity::getType( void )
00099 {
00100     return( type );
00101 }
00102 
00103 
00104 /*
00105 
00106 // ***********************************************
00107 // TestStub
00108 int
00109 main( int argc, char ** argv )
00110 {
00111     Entity e;
00112     e.setColor( Entity::GREEN );
00113     e.setX( 24 );
00114     e.setY( 54 );
00115     e.setAngle( 23 );
00116     cputw( e.getAngle( ) );
00117 }
00118 */
00119 

Generated on Wed Nov 29 01:27:41 2006 by  doxygen 1.4.6