1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
//IN SHIP.CPP
//Draw a bounding circle
void Ship::drawBound(){
int x1=SIZE, y1=0, deltaX=1-(SIZE<<1), deltaY=0, error=0, red=0, green=255, blue=255;
while(x>=y){
gfx.PutPixel(x1 + x, y1 + y, red, green, blue);
gfx.PutPixel(y1 + x, x1 + y, red, green, blue);
gfx.PutPixel(-x1 + x, y1 + y, red, green, blue);
gfx.PutPixel(-y1 + x, x1 + y, red, green, blue);
gfx.PutPixel(-x1 + x, -y1 + y, red, green, blue);
gfx.PutPixel(-y1 + x, -x1 + y, red, green, blue);
gfx.PutPixel(x1 + x, -y1 + y, red, green, blue);
gfx.PutPixel(y1 + x, -x1 + y, red, green, blue);
y++;
error+=deltaY;
deltaY+=2;
if(((error << 1)+deltaX)>0){
x--;
error+=deltaX;
deltaX+=2;
}
}
}
|