function param1() return "width", 1, 100, 4 end function param2() return "height", 1, 100, 4 end function circle( mx, my, w ) mx = math.floor( mx ) my = math.floor( my ) w = math.ceil( w ) local sy = my - w local dy = my + w local cx = bs_param1() * 2 local cy = bs_param2() * 2 local nx = cx / 2 local ny = cy / 2 local x,y for y=sy,dy do local py = y - my local s = w*w - py*py if s > 0 then s = math.ceil( math.sqrt( s ) ) local lx = mx - s local rx = mx + s local by = 0 local sy = y % cy if sy < ny then by = 1 end for x=lx,rx do local bx = 0 local sx = x % cx if sx < nx then bx = 1 end local r,g,b = bs_fore() local n = (bx + by) % 2 if n == 1 then r,g,b = bs_bg() end bs_pixel_set( x,y, r,g,b,255 ) end end end end function main( x, y, p ) local w = bs_width() if w < 0.25 then w = 0.25 end local updateDist = w / 2 if w > 5 then updateDist = w/4 end if w > 20 then updateDist = w/10 end if w > 100 then updateDist = w/14 end if not firstDraw then local distance = bs_distance( lastDrawX - x, lastDrawY - y ) if distance < updateDist then return 0 end end circle( x,y, w ) lastDrawX = x lastDrawY = y firstDraw = false return 1 end lastDrawX = 0 lastDrawY = 0 firstDraw = true