fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
f03565a
v2.1.3
1local downloader =require ( "downloader" ) 2 3function love . load ( args , unfilteredArgs ) 4if love . filesystem . mount ( "application.love" , "" ) then 5_LAUNCHER =true 6package . loaded . ssl =nil 7package . loaded . https =nil 8package . loaded . downloader =nil 9package . loaded . main =nil 10package . loaded . conf =nil 11love . conf =nil 12love . init () 13love . load ( args , unfilteredArgs ) 14else 15love . install () 16end 17end 18 19local STATUS ="" 20 21local DOWNLOAD_SIZE =0 22local DOWNLOADED =0 23 24function love . install () 25downloader . download ( 26"https://github.com/bkacjios/m-overlay/releases/latest/download/application.love" , 27"application.love" , 28 29function ( event ) 30if event . size then 31DOWNLOAD_SIZE =event . size 32elseif event . chunk then 33DOWNLOADED =DOWNLOADED + event . chunk 34STATUS =string . format ( "Downloading: %d%%" , DOWNLOADED / DOWNLOAD_SIZE * 100 ) 35elseif event . code and event . code == 200 then 36( "[UPDATER] Downloaded latest application.love" ) 37love . event . quit ( "restart" ) 38elseif event . error then 39( string . format ( "[UPDATER] Update error: %s" , event . error )) 40end 41end ) 42end 43 44function love . update ( dt ) 45downloader . update () 46end 47 48do 49local icon =love . graphics . newImage ( "textures/icon.png" ) 50local angleStart =math . pi * - 0.5 51local angleEnd =math . pi * 2 52local font =love . graphics . newFont ( 12 ) 53 54function love . draw () 55local sw , sh =love . graphics . getPixelDimensions () 56 57local w =icon : getWidth () 58local h =icon : getHeight () 59 60local cx , cy =sw / 2 , sh / 2 - ( sh / 16 ) 61 62love . graphics . setColor ( 1 , 1 , 1 , 1 ) 63love . graphics . draw ( icon , cx , cy , 0 , 0.5 , 0.5 , w / 2 , h / 2 ) 64 65local downloadAng =angleStart + ( angleEnd * ( DOWNLOADED / DOWNLOAD_SIZE )) 66 67love . graphics . setColor ( 34 / 255 , 177 / 255 , 76 / 255 , 1 ) 68love . graphics . setLineWidth ( 8 ) 69love . graphics . arc ( "line" , "open" , cx , cy , sw / 3 , angleStart , downloadAng ) 70 71local width =font : getWidth ( STATUS ) 72local sy =sh - 8 - font : getHeight () 73 74love . graphics . setFont ( font ) 75love . graphics . setColor ( 0 , 0 , 0 , 1 ) 76love . graphics . ( STATUS , cx + 1 , sy + 1 , 0 , 1 , 1 , width / 2 ) 77love . graphics . setColor ( 1 , 1 , 1 , 1 ) 78love . graphics . ( STATUS , cx , sy , 0 , 1 , 1 , width / 2 ) 79end 80end 81 82function love . quit () 83downloader . close () 84end