http = CreateHTTPConnection()
SetHTTPHost( http, "files.thegamecreators.com", 0 )
GetHTTPFile( http, "betafiles/Hands_On_AGK_Chapter_14_Text.pdf", "AGKFreeChapter.pdf" )
while GetHTTPFileComplete(http) = 0
Print( "Downloading: " + str(GetHTTPFileProgress(http)) )
Sync()
endwhile
CloseHTTPConnection(http)
DeleteHTTPConnection(http)
// main loop
do
Print( "The file is in your write folder" )
Sync()
loop
rem rem AGK Application 1.08B16 rem Get a Map Image from Google Maps rem MR SetDisplayAspect( 4.0/3.0 ) MainLoop() end function MainLoop() //spr=ShowImage("map.png") spr=GetMap() do if getpointerpressed()=1 then exit Sync() loop endfunction //Map Image //http://maps.googleapis.com/maps/api/staticmap?center=-15.800513,-47.91378&zoom=15&size=512x512&sensor=false //Streetview Image //http://maps.googleapis.com/maps/api/streetview?size=200x200&location=40.720032,%20-73.988354&heading=235&sensor=false function GetMap() //English //https://developers.google.com/maps/documentation/imageapis/?hl=en //German //https://developers.google.com/maps/documentation/imageapis/?hl=de spr=0 iSecure=0 szHost$="maps.googleapis.com" iHTTP= CreateHTTPConnection() ret=SetHTTPHost(iHTTP, szHost$, iSecure ) // N 51° 24.809' E 006° 51.668' (WGS84) // lat = degrees + minutes/60 (Google) //FLOAT! n#=51.0 + 24.809 /60.0 e#= 6.0 + 51.668 /60.0 szServerFile$="maps/api/staticmap?center="+str(n#)+","+str(e#)+"&zoom=15&size=512x512&sensor=false&maptype=hybrid" szLocalFile$="map.png" szPostData$="" f=GetHTTPFile( iHTTP, szServerFile$, szLocalFile$, szPostData$ ) ok=0 do p#=GetHTTPFileProgress(iHTTP) print("download ... " + str(p#)) ok=GetHTTPFileComplete(iHTTP) if ok=1 then exit if ok=-1 then exit Sync() loop CloseHTTPConnection( iHTTP ) DeleteHTTPConnection( iHTTP ) if ok=1 spr=ShowImage(szLocalFile$) else spr=createsprite(0) setspritecolor(spr,255,0,0,255) endif endfunction spr function ShowImage(szLocalFile$) spr=LoadSprite(szLocalFile$) setspritepositionbyoffset(spr,50,50) setspritesize(spr,-1,100) endfunction spr