diff options
Diffstat (limited to 'vectorgfx')
-rw-r--r-- | vectorgfx/obj1.2d | bin | 144 -> 148 bytes | |||
-rw-r--r-- | vectorgfx/obj2.2d | bin | 144 -> 148 bytes | |||
-rw-r--r-- | vectorgfx/test.bmx | 44 |
3 files changed, 32 insertions, 12 deletions
diff --git a/vectorgfx/obj1.2d b/vectorgfx/obj1.2d Binary files differindex f80ae2d..b998054 100644 --- a/vectorgfx/obj1.2d +++ b/vectorgfx/obj1.2d diff --git a/vectorgfx/obj2.2d b/vectorgfx/obj2.2d Binary files differindex 4f90927..b1936cf 100644 --- a/vectorgfx/obj2.2d +++ b/vectorgfx/obj2.2d 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 |