Lua: Fixed drawdisk which was drawing a square instead of a circle (doh!). Radius can now be a multiple of 0.5 to draw circles of even sizes (r=0 -> 1x1, r=0.5 -> 2x2, r=1 -> 3x3 etc.)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1798 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2011-06-14 21:52:20 +00:00
parent 2f3e1e3294
commit bf28d19f20
4 changed files with 36 additions and 21 deletions

View File

@@ -1340,6 +1340,20 @@ void Draw_filled_circle(short center_x,short center_y,short radius,byte color)
Update_part_of_screen(start_x,start_y,end_x+1-start_x,end_y+1-start_y);
}
int Circle_squared_diameter(int diameter)
{
int result = diameter*diameter;
// Trick to make some circles rounder, even though
// mathematically incorrect.
if (diameter==3 || diameter==9)
return result-2;
if (diameter==11)
return result-6;
if (diameter==14)
return result-4;
return result;
}
// -- Tracer général d'une ellipse vide -----------------------------------