Pixel-Composer/scripts/draw_circle_angle/draw_circle_angle.gml

23 lines
451 B
Plaintext
Raw Normal View History

2023-02-19 13:49:20 +01:00
function draw_circle_angle(_x, _y, _r, _angSt, _angEd, precision = 32) {
var ox, oy, nx, ny, oa, na;
draw_primitive_begin(pr_trianglelist);
for( var i = 0; i <= precision; i++ ) {
na = lerp(_angSt, _angEd, i / precision);
nx = _x + lengthdir_x(_r, na);
ny = _y + lengthdir_y(_r, na);
if(i) {
draw_vertex(_x, _y);
draw_vertex(ox, oy);
draw_vertex(nx, ny);
}
oa = na;
ox = nx;
oy = ny;
}
draw_primitive_end();
}