/* * MovingObjectClass.cpp * * Virtual MovingObject class implementation. * */ #include "GameData.h" #include "MovingObjectClass.h" MovingObject::MovingObject() { Center(.5,.5); Vector(0.,0.); Radius=0.; } MovingObject::MovingObject(Pos A, Pos B, float C) { Center=A; Vector=B; Radius=C; } // end con/de-structors Rect* MovingObject::bounds() { return &Bounds; } void MovingObject::moveOnScreen(void* data) { // Get the game data: Rect windowSize; typedef GameData* DataPrtType; DataPrtType Data=(DataPrtType)data; GetWindowPortBounds(Data->getGameWindowRef(),&windowSize); // Update the position: Old=Center; Center+=Vector; // Wrapcheck: If it disappears off one size, it has to come on on the other. if(Center.X-Radius>windowSize.right) Center.X-=(1+Radius+Radius); if(Center.X+RadiuswindowSize.bottom) Center.Y-=(1+Radius+Radius); if(Center.Y+RadiusgetGameWindowRef()); draw(Data->getGameWindowRef()); }