summaryrefslogtreecommitdiff
path: root/vectorgfx/test.bmx
diff options
context:
space:
mode:
Diffstat (limited to 'vectorgfx/test.bmx')
-rw-r--r--vectorgfx/test.bmx44
1 files changed, 32 insertions, 12 deletions
diff --git a/vectorgfx/test.bmx b/vectorgfx/test.bmx
index c32da04..7c3ae0a 100644
--- a/vectorgfx/test.bmx
+++ b/vectorgfx/test.bmx
@@ -23,19 +23,39 @@ Local o2:TVectorGfxObject=TVectorGfxObject.Load("obj2.2d")
Local cm:TVectorGfxCollisionMap=TVectorGfxCollisionMap.Create(MSIZE,MSIZE)
+Local l:TList=CreateList()
+
Rem
-o1.AddLine(TVectorGfxLine.Create(-SIZE,SIZE,SIZE,SIZE,255,0,0,1))
-o1.AddLine(TVectorGfxLine.Create(SIZE,SIZE,SIZE,-SIZE,0,255,0,2))
-o1.AddLine(TVectorGfxLine.Create(SIZE,-SIZE,-SIZE,-SIZE,255,0,0,1))
-o1.AddLine(TVectorGfxLine.Create(-SIZE,-SIZE,-SIZE,SIZE,0,255,0,2))
+l.Clear()
+l.AddLast(TVectorGfxPoint.Create(-SIZE,-SIZE))
+l.AddLast(TVectorGfxPoint.Create(SIZE,-SIZE))
+l.AddLast(TVectorGfxPoint.Create(SIZE,SIZE))
+l.AddLast(TVectorGfxPoint.Create(-SIZE,SIZE))
+o1.SetPoints(l.ToArray())
+
+l.Clear()
+l.AddLast(TVectorGfxLine.Create(0,1,255,0,0,1))
+l.AddLast(TVectorGfxLine.Create(1,2,0,255,0,2))
+l.AddLast(TVectorGfxLine.Create(2,3,255,0,0,1))
+l.AddLast(TVectorGfxLine.Create(3,0,0,255,0,2))
+o1.SetLines(l.ToArray())
o1.x=400
o1.y=300
o1.Save("obj1.2d")
-o2.AddLine(TVectorGfxLine.Create(-SIZE,SIZE/2,SIZE,SIZE/2,255,255,255,0))
-o2.AddLine(TVectorGfxLine.Create(SIZE,SIZE/2,SIZE,-SIZE/2,255,255,255,0))
-o2.AddLine(TVectorGfxLine.Create(SIZE,-SIZE/2,-SIZE,-SIZE/2,255,255,255,0))
-o2.AddLine(TVectorGfxLine.Create(-SIZE,-SIZE/2,-SIZE,SIZE/2,255,255,255,0))
+l.Clear()
+l.AddLast(TVectorGfxPoint.Create(-SIZE/2,-SIZE/2))
+l.AddLast(TVectorGfxPoint.Create(SIZE/2,-SIZE/2))
+l.AddLast(TVectorGfxPoint.Create(SIZE/2,SIZE/2))
+l.AddLast(TVectorGfxPoint.Create(-SIZE/2,SIZE/2))
+o2.SetPoints(l.ToArray())
+
+l.Clear()
+l.AddLast(TVectorGfxLine.Create(0,1,255,255,255,0))
+l.AddLast(TVectorGfxLine.Create(1,2,255,255,255,0))
+l.AddLast(TVectorGfxLine.Create(2,3,255,255,255,0))
+l.AddLast(TVectorGfxLine.Create(3,0,255,255,255,0))
+o2.SetLines(l.ToArray())
o2.Save("obj2.2d")
EndRem
@@ -86,11 +106,11 @@ 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()
+ For Local i:Int=0 To 3
+ Local p:TVectorGfxPoint[]=o1.AdjustedCoords(i)
+ Local v:TVector=o1.Normal(i)
SetColor(0,0,255)
- DrawLine(p[0].x,p[0].y,p[0].x+v.x*20,p[0].y+v.y*20)
+ DrawLine(o1.x+p[0].x,o1.y+p[0].y,o1.x+p[0].x+v.x*20,o1.y+p[0].y+v.y*20)
Next
DrawText MilliSecs() + ":Col=" + o2.Draw(cm),0,0