Challenge:
Version:
(Version C)
Winner?:
No
Code Snippet:
size# = 30 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(255,0,0),rgb(0,0,0),20) loop function poly(x as integer, y as integer, sides as integer, size as float, angle as float, color as dword, glow as dword, glow_thickness as integer) dim side(sides,1) ang# = 360.0/sides x1 = x + sin(angle)*size y1 = y + cos(angle)*size red = rgbr(color) green = rgbg(color) blue = rgbb(color) gr = rgbr(glow) gg = rgbg(glow) gb = rgbb(glow) for g = 0 to glow_thickness-1 d# = (g+1.0)/glow_thickness cr = red + (gr-red)*d# cg = green + (gg-green)*d# cb = blue + (gb-blue)*d# ink rgb(cr,cg,cb),0 for t = 1 to sides x2 = x + sin(wrapvalue((ang#*t)+angle))*size y2 = y + cos(wrapvalue((ang#*t)+angle))*size if g = 0 side(t,0) = x1 side(t,1) = y1 endif line x1,y1,x2,y2 x1 = x2 y1 = y2 next t inc size, 1 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