size# = 15 do cls angle# = wrapvalue(angle#+0.5) if mouseclick()=1 then inc size#,1 if mouseclick()=2 then dec size#,1 poly(mousex(),mousey(),5,size#,angle#,rgb(150,0,220),6) loop function poly(x as integer, y as integer, sides as integer, size as float, angle as float, color as dword, depth as integer) dim side(sides,1) ang# = 360.0/sides x1 = x + sin(angle)*size y1 = y + cos(angle)*size for g = 0 to depth-1 if g = 0 ink color,0 else ink rgb(100,100,100),0 endif for t = 1 to sides x2 = x + sin(wrapvalue((ang#*t)+angle))*size y2 = y + cos(wrapvalue((ang#*t)+angle))*size side(t,0) = x1 side(t,1) = y1 line x1+g,y1+g,x2+g,y2+g x1 = x2 y1 = y2 next t next g lock pixels x1 = x-size x2 = x+size y1 = y-size y2 = y+size for a = x1 to x2 for b = y1 to y2 if a>0 and a<screen width() if b>0 and b<screen height() count = 0 for t = 1 to sides j = t+1 if j>sides then j=1 dp# = (side(j,0) - side(t,0)) * (b - side(t,1)) - (a - side(t,0)) * (side(j,1) - side(t,1)) inc count, (dp# > 0) next t if count = 0 start = get pixels pointer() repeat_number = get pixels pitch() bits_per_pixel = bitmap depth(num)/8 pointer = start + b*repeat_number + a*bits_per_pixel *pointer = color endif endif endif next b next a unlock pixels undim side() endfunction