summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--algorithm/test.bmx2
-rw-r--r--vectorgfx/test.bmx29
2 files changed, 30 insertions, 1 deletions
diff --git a/algorithm/test.bmx b/algorithm/test.bmx
index 1da25c3..e303204 100644
--- a/algorithm/test.bmx
+++ b/algorithm/test.bmx
@@ -27,6 +27,7 @@ While Not KeyHit(KEY_ESCAPE)
SetColor(Rand(100,255),Rand(100,255),Rand(100,255))
Plot(p.x,p.y)
Next
+ EndRem
Local pa:TAlgoPoint[]=DoCircle(Rand(0,SCRW),Rand(0,SCRH),Rand(100,200))
@@ -36,7 +37,6 @@ While Not KeyHit(KEY_ESCAPE)
SetColor(Rand(100,255),Rand(100,255),Rand(100,255))
DrawLine(pa[f].x,pa[f].y,pa[nf].x,pa[nf].y)
Next
- EndRem
SetColor(255,0,0)
DrawLine(x1,y1,x2,y2)
diff --git a/vectorgfx/test.bmx b/vectorgfx/test.bmx
index cbe1f64..c32da04 100644
--- a/vectorgfx/test.bmx
+++ b/vectorgfx/test.bmx
@@ -39,6 +39,24 @@ o2.AddLine(TVectorGfxLine.Create(-SIZE,-SIZE/2,-SIZE,SIZE/2,255,255,255,0))
o2.Save("obj2.2d")
EndRem
+Type FadeLine Extends TVectorGfxLineStyle
+ Method Draw:Int(x1:Int, y1:Int, x2:Int, y2:Int, r:Int, g:Int, b:Int, id:Int, colmap:TVectorGfxCollisionMap)
+ Local mask:Int=0
+ Local lp:TList=DoLine(x1,y1,x2,y2)
+
+ For Local p:TAlgoPoint=EachIn lp
+ SetColor(r,g,b)
+ mask:|colmap.SetCollision(p.x,p.y,id)
+ Plot(p.x,p.y)
+ r=Max(0,r-10)
+ g=Max(0,g-10)
+ b=Max(0,b-10)
+ Next
+
+ Return mask
+ End Method
+End Type
+
While Not KeyHit(KEY_ESCAPE)
Cls
@@ -57,6 +75,10 @@ While Not KeyHit(KEY_ESCAPE)
VectorGfxSetThickAlpha(0.2)
EndIf
+ If KeyHit(KEY_F4)
+ VectorGfxSetCustom(New FadeLine)
+ EndIf
+
o1.Draw(cm)
o1.ang=(o1.ang+2) Mod 3600
@@ -64,6 +86,13 @@ While Not KeyHit(KEY_ESCAPE)
o2.y=MouseY()
o2.Draw(cm)
+ For Local l:TVectorGfxLine=EachIn o1.lines
+ Local p:TAlgoPoint[]=l.AdjustedCoords()
+ Local v:TVector=l.Normal()
+ SetColor(0,0,255)
+ DrawLine(p[0].x,p[0].y,p[0].x+v.x*20,p[0].y+v.y*20)
+ Next
+
DrawText MilliSecs() + ":Col=" + o2.Draw(cm),0,0
Flip