uses gdip

Screen 640,480,1
SetCaption "Gdiplus TileSprite Demo"

sys font,fo,bild,stern,x,y,mouse 
sys dir=1,x1,y1=480-64,zr=12,zl=8,zu=4,zd=0
single r,v1,v2,v3,v4

font = LoadImage "png/afont.png",60
bild = LoadImage "png/bild4.jpg",1 
fo   = LoadImage "png/font16x.png",94
mouse= LoadTiles "png/bitmap.png",16,4

While Key(27)=0
'ClsColor 255,20,200,248
ZoomImage bild,0,0,640,480
iText font,32,0,"HELLO IS A SDL DEMO" 
iText fo,32,32,"PRESS ESCAPE" 
iText fo,32,64,"FRAMES:" + ShowFps 

iF dir=1
    drawTiles mouse,x1,y1,zr,0
    v1 +=.2
    iF v1 >=1
       v1=0
       inc zr
       iF zr=16 then zr=12
    End iF
    inc x1
    iF x1 >= 640-64 
       dir=2 
       zr=12
    End iF
End iF   
iF dir=2
    DrawTiles mouse,x1,y1,zu,0
    v2 +=.2
    iF v2 >=1
       v2 =0
       inc zu
       iF zu=8 then zu=4
    End iF
    dec y1
    iF y1 <= 0 
       dir=3 
       zu=4
    End iF
End iF
iF dir=3
    DrawTiles mouse,x1,y1,zl,0
    v3 +=.2  
    iF v3 >=1
       v3=0
       inc zl
       iF zl=12 then zl=8
    End iF
    dec x1
    iF x1 <= 0 
       dir=4 
       zl=8
    End iF
End iF
iF dir=4
    DrawTiles mouse,x1,y1,zd,0
    v4 +=.2
    iF v4 >=1
       v4=0
       inc zd
       iF zd=4 then zd=0
    End iF
    inc y1
    iF y1 >= 480-64 
       dir=1 
       zd=0
    End iF
 End iF   

Flip 
SetFps 60'140
inc x
inc y
r += 0.5
iF r=360 Then r=-360
iF x=6 Then x=0
iF y=60 Then y=0
Wend
Ends