New, simple, fun drawing function

This function allows you to draw triangles, filled or wired, pentagons, or even circles!
Place this in Global Code.
To use:
Make a canvas, and in draw actor, choose rather you want filled or non-filled.
^ The following will draw a diamond around the mouse the size of 166 pixels each side.
Usage:
drawCircle(X, Y, Size, Detail);
same with filled
Screenshots:
- Code: Select all
void drawCircle(int X, int Y, double size, double detail)
{
double i;
for(i=-3.14159;i<3.14159;i+=3.14159/(detail/2))
{
moveto(X+cos(1.570795+(i))*size, Y+sin(1.570795+(i))*size);
lineto(X+cos(1.570795+(i+(3.14159/detail*2)))*size, Y+sin(1.570795+(i+(3.14159/detail*2)))*size);
}
}
void drawFilledCircle(int X, int Y, double size, double detail)
{
double i, i2;
for(i2=0;i2<size;i2+=1)
{
for(i=-3.14159;i<3.14159;i+=3.14159/(detail/2))
{
moveto(X+cos(1.570795+(i))*i2, Y+sin(1.570795+(i))*i2);
lineto(X+cos(1.570795+(i+(3.14159/detail*2)))*i2, Y+sin(1.570795+(i+(3.14159/detail*2)))*i2);
}
}
}
Place this in Global Code.
To use:
Make a canvas, and in draw actor, choose rather you want filled or non-filled.
- Code: Select all
erase(0, 0, 0, 1);
setpen(255, 255, 255, 0, 1);
drawFilledCircle(xmouse, ymouse, 166, 4);
^ The following will draw a diamond around the mouse the size of 166 pixels each side.
Usage:
drawCircle(X, Y, Size, Detail);
same with filled
Screenshots: