1. ## Bresenham Circle Algorithm

Does anyone have experience with this algo.. i can't seem to get it working right (i converted the code i found on gamedev from pascal to c++)?

Code:
```
PHP Code:
```
int d,mx,my;

mx = 0;

while(my != mx)
{
DrawPixel(surface,x+mx,y+my,color);
DrawPixel(surface,x+mx,y-my,color);
DrawPixel(surface,x-mx,y+my,color);
DrawPixel(surface,x-mx,y-my,color);
DrawPixel(surface,x+my,y+mx,color);
DrawPixel(surface,x+my,y-mx,color);
DrawPixel(surface,x-my,y+mx,color);
DrawPixel(surface,x-my,y-mx,color);

if(d < 0)
d += (4*mx)+6;
else
{
d += 4*(mx-my) + 10;
my--;
}
}

```
```
edit: It is drawing a + sign rather than an O.. I'm trying to figure this one out but so far no luck.

2. I don't remember if it was Bresenham's or another one, but I got it to work with DirectDraw. I'll try and find it.

3. Here's the algorithm I used: (it's almost actual code so you should be able to modify it to what you need)
Code:
```int x_center;  // the center of the circle
int y_center;

int x;  // used for the algorithm to draw points on the border
int y;

PutPixel( x_center, y_center + radius );
PutPixel( x_center, y_center - radius );
PutPixel( x_center + radius, y_center );
PutPixel( x_center - radius, y_center );

x = 1;
y = (int)( sqrt( r2 - 1 ) + 0.5 );

while( x < y ) {

PutPixel( x_center + x, y_center + y );
PutPixel( x_center + x, y_center - y );
PutPixel( x_center - x, y_center + y );
PutPixel( x_center - x, y_center - y );
PutPixel( x_center + y, y_center + x );
PutPixel( x_center + y, y_center - x );
PutPixel( x_center - y, y_center + x );
PutPixel( x_center - y, y_center - x );

++x;
y = (int)( sqrt( r2 - x * x ) + 0.5 );
}
if (x == y) {

PutPixel( x_center + x, y_center + y );
PutPixel( x_center + x, y_center - y );
PutPixel( x_center - x, y_center + y );
PutPixel( x_center - x, y_center - y );
}```

4. does this help?

Code:
```void retro_circle(int xc, int yc, int r)
{
int x,
y,
d,

y = r;
d = 1 - r;

for (x = 0; x < y; x++)
{
if (d < 0)
{
d += x * 2 + 3;
}
else
{
d += x * 2 - y * 2 + 5;
y--;
}

vga_drawpixel(xc + x, yc + y);
vga_drawpixel(xc - x, yc + y);
vga_drawpixel(xc + x, yc - y);
vga_drawpixel(xc - x, yc - y);
vga_drawpixel(xc + y, yc + x);
vga_drawpixel(xc - y, yc + x);
vga_drawpixel(xc + y, yc - x);
vga_drawpixel(xc - y, yc - x);
}
}```

5. ## thanks for all the help

thanks for all the help i got it working now