summaryrefslogtreecommitdiff
path: root/vectorgfx/test.bmx
diff options
context:
space:
mode:
Diffstat (limited to 'vectorgfx/test.bmx')
-rw-r--r--vectorgfx/test.bmx66
1 files changed, 45 insertions, 21 deletions
diff --git a/vectorgfx/test.bmx b/vectorgfx/test.bmx
index 0b12e11..191a81b 100644
--- a/vectorgfx/test.bmx
+++ b/vectorgfx/test.bmx
@@ -8,7 +8,7 @@ Const SCRH=600'1024
SetGraphicsDriver GLMax2DDriver()
Graphics SCRW,SCRH,32,60' Or HARDSYNC
-'HideMouse()
+HideMouse()
SetBlend(ALPHABLEND)
@@ -45,22 +45,31 @@ o1.y=300
o1.Save("obj1.2d")
l.Clear()
-l.AddLast(TVectorGfxPoint.Create(-SIZE,0))
-l.AddLast(TVectorGfxPoint.Create(SIZE,0))
+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
-Local o3:TVectorGfxObject=o1.Clone()
-o3.x:/2
+Local o3:TList=CreateList()
+
+For Local f:Int=2 To 40
+ Local o:TVectorGfxObject=o1.Clone()
+ o.x=o1.x/f
+ o3.AddLast(o)
+Next
Type FadeLine Extends TVectorGfxLineStyle
- Method Draw:Int(x1:Int, y1:Int, x2:Int, y2:Int, r:Int, g:Int, b:Int, id:Int, obj:TVectorGfxObject, line:Int, colmap:TVectorGfxCollisionMap, actor:Int, list:TList)
- 'Method Draw:Int(x1:Int, y1:Int, x2:Int, y2:Int, r:Int, g:Int, b:Int, id:Int, colmap:TVectorGfxCollisionMap)
+ Method LineToCollisionMap:Int(x1:Int, y1:Int, x2:Int, y2:Int, r:Int, g:Int, b:Int, id:Int, obj:TVectorGfxObject, line:Int, colmap:TVectorGfxCollisionMap, actor:Int, list:TList)
Local mask:Int=0
Local lp:TList=DoLine(x1,y1,x2,y2)
@@ -92,6 +101,21 @@ Type FadeLine Extends TVectorGfxLineStyle
Return mask
End Method
+ Method LineToPointList:Int(x1:Int, y1:Int, x2:Int, y2:Int, r:Int, g:Int, b:Int, list:TList)
+ Local mask:Int=0
+ Local lp:TList=DoLine(x1,y1,x2,y2)
+
+ For Local p:TAlgoPoint=EachIn lp
+ SetColor(r,g,b)
+ Plot(p.x,p.y)
+ list.AddLast(TVectorGfxPoint.Create(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
Type Particle
@@ -161,14 +185,6 @@ While Not KeyHit(KEY_ESCAPE)
EndIf
If KeyHit(KEY_F2)
- VectorGfxSetAlpha(0.5,0.5)
- EndIf
-
- If KeyHit(KEY_F3)
- VectorGfxSetThickAlpha(0.2)
- EndIf
-
- If KeyHit(KEY_F4)
VectorGfxSetCustom(New FadeLine)
EndIf
@@ -180,16 +196,19 @@ While Not KeyHit(KEY_ESCAPE)
o1.scale:-0.1
EndIf
- o1.Draw(cm)
- o1.ang=(o1.ang+2) Mod 3600
-
- o3.Draw(cm)
+ o1.DrawToCollisionMap(cm)
+ o1.ang=(o1.ang+10) Mod 3600
+ 'o2.ang=(o2.ang+5) Mod 3600
+
+ For Local o:TVectorGfxObject=EachIn o3
+ o.DrawToCollisionMap(cm)
+ Next
o2.x=MouseX()
o2.y=MouseY()
list.Clear()
- o2.Draw(cm,True,list)
+ o2.DrawToCollisionMap(cm,True,list)
SetColor(255,0,255)
For Local c:TVectorGfxCollision=EachIn list
@@ -205,9 +224,14 @@ While Not KeyHit(KEY_ESCAPE)
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()-t) + ":Col=" + o2.Draw(cm),0,0
+ SetColor(255,255,255)
+ DrawText (MilliSecs()-t) + ":Col=" + o2.DrawToCollisionMap(cm),0,0
DrawText MemAlloced(),0,10
+ If o1.IsInside(MouseX(),MouseY())
+ DrawText "INSIDE!",0,20
+ EndIf
+
Flip
FlushMem
Wend