Main Menu

Fat Lines

Started by kevin, July 14, 2006, 02:10:42 PM

Previous topic - Next topic

kevin



x1=rnd(800)
y1=rnd(600)
linewidth=10

Do
 Cls 0


  if Mousebutton()=1
   x1=rnd(800)
   y1=rnd(600)
  endif
 
 
  if Mousebutton()=2
   inc linewidth
   if linewidth>50 then linewidth=1
  endif
 
 
  mx=mousex()
  my=mousey()
 
   FatLine(x1,y1,mx,my,LineWidth,rgb(25,255,20))
 
 Sync
loop



Function FatLine(x1,y1,x2,y2,LineWidth,ThisRGB)

   Radius#=LineWidth/2.0
   Angle#=GetAngle2D(x2,y2,x1,y1)
   Angle#=wrapangle(Angle#,-90)
   vx1#=cosnewvalue(x1,angle#,Radius#)  
   vy1#=sinnewvalue(y1,angle#,Radius#)  

   vx2#=cosnewvalue(x2,angle#,Radius#)  
   vy2#=sinnewvalue(y2,angle#,Radius#)  

 Angle#=wrapangle(Angle#,180)


   vx3#=cosnewvalue(x2,angle#,Radius#)  
   vy3#=sinnewvalue(y2,angle#,Radius#)  

   vx4#=cosnewvalue(x1,angle#,Radius#)  
   vy4#=sinnewvalue(y1,angle#,Radius#)  
  Quadc vx1#,vy1#,vx2#,vy2#,vx3#,vy3#,vx4#,vy4#,ThisRgb

EndFunction






Ian Price

Ask and ye shall receive, eh Stef? :P

Nice one Kevin. :)
I came. I saw. I played some Nintendo.

stef


stef

and it is pretty fast!

nearly same speed as "lineC"