Didn't work. I get an 'Illegal operation on empty list'.
Strict
Graphics 800,600,0,20
Global ImageList:TList = New TList
Local block:Image = New Image
'loading path to graphics
'and create objects
Function LoadPieces()
Local gh = GraphicsHeight() / 2
Local gw = GraphicsWidth() / 2
'string array
Local arrPath:String[]=["gfx/blue.bmp","gfx/green.bmp","gfx/yellow.bmp","gfx/red.bmp","gfx/orange.bmp","gfx/violet.bmp"]
For Local i:String = EachIn arrPath
Image.Create(i,gw,gh,1.0,1.0)
Next
End Function
Type Image
Global ImageListCount:Int =0
Field xpos,ypos:Int
Field _image:TImage
Field AlphaLevel:Float
Field Scale:Float
'instantiate and each object to List
Function Create:Image(strPath:String,startXpos:Int,startYpos:Int,imgAlpha:Float,imgScale:Float)
Local img:Image = New Image
img._image = LoadImage(strPath)
ImageListCount:+1
img.xpos = startXpos
img.ypos = startYpos
img.AlphaLevel = imgAlpha
img.Scale = imgScale
ListAddLast ImageList, img
End Function
'go thru each object, scale it and fade object
Method Update(img:Image)
Scale:+1.0
AlphaLevel:-0.1
If Scale >= 15.0 Then
ListRemove ImageList, img
Scale=1.0
AlphaLevel=1.0
EndIf
End Method
Method Render()
SetBlend ALPHABLEND
'For Local i:Image = EachIn ImageList
'Local current:TLink = ImageList.FirstLink()
'Local myImage:Image = Image(current._value)
Print "debug"
Local myImage:Image = Image(ImageList.First())
Print "1"
'MidHandleImage i._image
MidHandleImage myImage._image
SetScale Scale,Scale
SetAlpha AlphaLevel
'DrawImage i._image, (i.xpos), i.ypos
DrawImage myImage._image, (myImage.xpos), myImage.ypos
'Update(i)
Update(myImage)
'Exit
'Next
End Method
Method Reset()
If ListIsEmpty(ImageList) = True Then
LoadPieces()
EndIf
End Method
End Type
'main
While Not KeyHit(KEY_ESCAPE)
Cls
block.render()
'check to see if all objects are destroy; if so start over
block.reset()
Flip()
FlushMem()
Wend
'destroy i or blitz takes care of this for me when
'the program ends
block=Null
|