bool GuideRibbonEllipse::idealize(::pb::GuideRibbon* pOut) const { ::pb::GuideRibbon::Ellipse* idea = pOut->mutable_ellipse(); { idea->mutable_center()->set_x( getCenterX() ); idea->mutable_center()->set_y( getCenterY() ); idea->mutable_radius()->set_x( getRadiusX() ); idea->mutable_radius()->set_y( getRadiusY() ); idea->set_angle0( getBeginAngle() ); idea->set_angle1( getEndAngle() ); idea->set_direction( getDirection() ); } return true; }
void SpaceShip::draw(LPDIRECT3DDEVICE9 d3dDevice) { // draw the projectiles fired by the ship for(unsigned int i=0;i<projectiles.size();i++) { projectiles.at(i)->draw(d3dDevice); } // draw the ship spaceShipSprite->draw(&scale, &offset, orientation, &offset, &position, d3dDevice); // if debugging, draw a collision detection circle around the ship #if _DEBUG testDrawPoint(d3dDevice, getX(), getY()); testDrawPoint(d3dDevice, getX() + (cos(D3DXToRadian(orientation - 90)) * 10), getY() + (sin(D3DXToRadian(orientation - 90)) * 10)); testDrawEmptyCircle(d3dDevice, getX(), getY(), getRadiusX(), getRadiusY()); #endif }
bool SpaceShip::checkCollision(Object & o) { // is the space ship colliding with another object? float distance = sqrt(pow(o.getX() - getX(), 2) + pow(o.getY() - getY(), 2)); return distance < o.getRadiusX() + getRadiusX(); }