LoadImageAsync Example
Tweet monkey-x networking code-archives file-utilities
Loads an external image through URL then displays to screen after completion.
Import mojo
Class MyApp Extends App Implements IOnLoadImageComplete
Field image:Image
Method OnCreate()
LoadImageAsync( "http://cdn.blitzcoder.org/images/logos/monkey-x.png",,,Self )
SetUpdateRate 60
End
Method OnUpdate()
UpdateAsyncEvents
End
Method OnRender()
Cls
DrawText "Hello World!",0,0
If image Then
PushMatrix
Scale 0.5,0.5
DrawImage image,DeviceWidth/2,DeviceHeight/2
PopMatrix
End If
End
Method OnLoadImageComplete:Void( image:Image,path:String,source:IAsyncEventSource )
If image Print "OK!" Else Print "ERR"
Self.image=image
End
End
Function Main()
New MyApp
End
Reply To Topic (minimum 10 characters)
Please log in to reply