-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
1 lines (1 loc) · 14.3 KB
/
index.html
1
<!doctypehtml><html lang=en-us><!-- ######################### HEAD ############################# --><head><title>Adventure Game Studio</title><meta charset=utf-8><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta content=#000000 name=theme-color><meta content=yes name=apple-mobile-web-app-capable><meta content=black name=apple-mobile-web-app-status-bar-style><style>body{font-family:'Lucida Console',Monaco,monospace;font-size:160%;margin:0;padding:0;width:100%;height:100%;background-color:#000}button{font-family:'Lucida Console',Monaco,monospace;font-size:90%}.emscripten{padding-right:0;margin-left:auto;margin-right:auto;display:block}div.emscripten{text-align:center}div.emscripten_border{border:0}canvas.emscripten{position:absolute!important;top:0!important;left:0!important;margin:0;width:100%!important;height:100%!important;overflow:hidden;display:block;min-height:180px;min-width:320px;border:0 none;background-color:#000;z-index:1}.button{appearance:none;background:#0000d4;border-radius:.25em;color:#fff;cursor:pointer;display:inline-block;height:3em;line-height:3em;padding:0 1em;border:2px solid #0000d4;white-space:normal}.button:hover{background-color:#2a7fff;border:2px solid #2a7fff}.button:disabled,.button[disabled]{border:2px solid #999;background-color:#ccc;color:#666}#textmsgs{left:50%;top:50%;-ms-transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align:center;margin:auto;position:absolute;overflow:hidden;color:#787878;z-index:1000}@-webkit-keyframes levitate{0%{transform:translate(-50%,0)}50%{transform:translate(-50%,-50%)}100%{transform:translate(-50%,0)}}@-moz-keyframes levitate{0%{transform:translate(-50%,0)}50%{transform:translate(-50%,-50%)}100%{transform:translate(-50%,0)}}@-o-keyframes levitate{0%{transform:translate(-50%,0)}50%{transform:translate(-50%,-50%)}100%{transform:translate(-50%,0)}}@keyframes levitate{0%{transform:translate(-50%,0)}50%{transform:translate(-50%,-50%)}100%{transform:translate(-50%,0)}}@-webkit-keyframes rotation{0%{transform:rotate(-30deg)}50%{transform:rotate(30deg)}100%{transform:rotate(-30deg)}}@-moz-keyframes rotation{0%{transform:rotate(-30deg)}50%{transform:rotate(30deg)}100%{transform:rotate(-30deg)}}@-o-keyframes rotation{0%{transform:rotate(-30deg)}50%{transform:rotate(30deg)}100%{transform:rotate(-30deg)}}@keyframes rotation{0%{transform:rotate(-30deg)}50%{transform:rotate(30deg)}100%{transform:rotate(-30deg)}}.gears-cont{position:fixed;bottom:0;right:0;width:20vh;height:20vh;z-index:1000}.gears{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -0.5 12 14' shape-rendering='crispEdges'%3E%3Cpath stroke='%23000000' d='M4 0h4M2 1h3M7 1h3M1 2h1M4 2h1M7 2h1M10 2h1M1 3h1M10 3h1M1 4h1M10 4h1M0 5h1M11 5h1M0 6h1M3 6h1M5 6h2M8 6h1M11 6h1M0 7h1M11 7h1M0 8h2M10 8h2M1 9h1M10 9h1M1 10h1M4 10h1M7 10h1M10 10h1M1 11h4M7 11h4M2 12h8M4 13h4' /%3E%3Cpath stroke='%23ffffff' d='M5 1h2M2 2h2M5 2h2M8 2h2M2 3h3M7 3h3M3 4h1M5 4h2M8 4h1M1 5h2M4 5h1M7 5h1M9 5h2M1 6h2M4 6h1M7 6h1M9 6h2M3 7h1M5 7h2M8 7h1M2 8h3M7 8h3M2 9h2M5 9h2M8 9h2M5 10h2' /%3E%3Cpath stroke='%23847e87' d='M5 3h2M2 4h1M4 4h1M7 4h1M9 4h1M3 5h1M5 5h2M8 5h1M1 7h2M4 7h1M7 7h1M9 7h2M5 8h2M4 9h1M7 9h1M2 10h2M8 10h2M5 11h2' /%3E%3C/svg%3E");background-repeat:no-repeat;background-position:center;background-size:48% 56%;width:100%;height:100%;opacity:.1}.gears:hover{opacity:.9}.bluecup{background-image:url("data:image/svg+xml,%3Csvg width='96' height='64' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cg shape-rendering='crispEdges'%3E%3Crect style='fill:%23fff%3Bfill-rule:evenodd' width='10' height='7'/%3E%3Crect style='fill:%23fff' width='12' height='5' y='1'/%3E%3Crect style='fill:%23fff' width='8' height='8' x='1'/%3E%3Crect style='fill:%232a7fff' width='8' height='5' x='1' y='1'/%3E%3Crect style='fill:%232a7fff' width='6' height='1' x='2' y='6'/%3E%3Crect style='fill:%232a7fff' width='2' height='3' x='9' y='2'/%3E%3Crect style='fill:%23fff' width='1' height='1' x='9' y='3'/%3E%3Crect style='fill:%230000d4' width='6' height='3' x='2' y='2'/%3E%3Crect style='fill:%230000d4' width='4' height='1' x='3' y='5'/%3E%3Crect style='fill:%23fff' width='6' height='1' x='2' y='1'/%3E%3C/g%3E%3C/svg%3E");left:50%;top:64%;width:96px;height:64px;margin:0 auto;position:absolute;z-index:1000;transform:translate(-50%,0)}.bluecup.rotate{-webkit-animation:rotation 1s ease-in-out infinite;-moz-animation:rotation 1s ease-in-out infinite;-o-animation:rotation 1s ease-in-out infinite;animation:rotation 1s ease-in-out infinite}.bluecup.levitate{-webkit-animation:levitate 4s ease-in-out infinite;-moz-animation:levitate 4s ease-in-out infinite;-o-animation:levitate 4s ease-in-out infinite;animation:levitate 4s ease-in-out infinite}#status{display:inline-block;vertical-align:top;margin-top:30px;margin-left:20px;font-weight:700;color:#787878}#controls{left:50%;top:32%;-ms-transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align:center;margin:auto;position:absolute;overflow:hidden;color:#787878;z-index:100}.modal{display:none;position:fixed;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:#000;background-color:rgba(0,0,0,.5);z-index:1001}.modal-content{left:50%;top:50%;-ms-transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align:center;margin:auto;position:absolute;background-color:#fefefe;padding:20px;border:1px solid #888;width:64%}.modal-header{padding:2px 16px}.modal-header-content{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-flex-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center}.modal-body{padding:2px 16px}.modal-close{color:#aaa;float:right;font-size:200%;font-weight:700}.modal-close:focus,.modal-close:hover{color:#000;text-decoration:none;cursor:pointer}</style></head><!-- ######################### BODY ############################# --><body><div class="bluecup rotate"id=bcup></div><div class=emscripten id=status>Downloading...</div><div class=modal id=cfgModal><div class=modal-content><div class=modal-header><span id=cfgClose class=modal-close>×</span><div class=modal-header-content>Options</div></div><div class=modal-body><br><button class=button id=btnClearPF type=button>Clear persistent files</button><br><br><button class=button id=btnToggleFS type=button disabled>Toggle Fullscreen</button></div></div></div><span hidden id=controls><span><input id=agsgamepkgid type=file accept=*/* hidden multiple name=agsgamepkg onchange=agsAttachFileInput(this)><label class=button for=agsgamepkgid>Select .ags game and files</label></span><span hidden><input id=resize type=checkbox checked>Resize canvas</span><span hidden><input id=pointerLock type=checkbox checked>Lock/hide mouse pointer</span></span><div class=emscripten></div><div class=emscripten_border><canvas class=emscripten id=canvas oncontextmenu=event.preventDefault() tabindex=-1></canvas></div><div id=textmsgs></div><div class=gears-cont><div class=gears id=gearBtn></div></div><script src=my_game_files.js></script><script>var saved_games_path="/home/web_user/saved_games",file_being_loaded="",fileresulthere={},file_read_count=0,file_total_count=1,game_file="",t_rs_id=0;file_read_count=0;var btnClearPF=document.getElementById("btnClearPF"),btnToggleFS=document.getElementById("btnToggleFS"),cfgModal=document.getElementById("cfgModal"),gearBtn=document.getElementById("gearBtn"),cfgClose=document.getElementById("cfgClose");function fscrExitHandler(){0==Module._ext_get_windowed()&&(Module._ext_toggle_fullscreen(),Module.canvas.dispatchEvent(new Event("resize")))}function fscrChangeHandler(){document.fullscreenElement||document.webkitIsFullscreen||document.mozFullScreen||document.msFullscreenElement||fscrExitHandler()}function initializeFullscreenControlHandling(){"webkitFullscreenEnabled"in document&&!Module._ext_fullscreen_supported()?document.webkitFullscreenEnabled?btnToggleFS.onclick=function(){""!==game_file&&(document.fullscreenElement?document.exitFullscreen&&document.exitFullscreen():(document.getElementById("canvas").requestFullscreen(),closeCfg(),Module.canvas.dispatchEvent(new Event("resize"))))}:(btnToggleFS.hidden=!0,btnToggleFS.style.display="none"):("mozFullScreenEnabled"in document?document.addEventListener("mozfullscreenchange",fscrChangeHandler):"msFullscreenEnabled"in document?document.addEventListener("MSFullscreenChange",fscrChangeHandler):"fullscreenEnabled"in document&&document.addEventListener("fullscreenchange",fscrChangeHandler),btnToggleFS.onclick=function(){""!==game_file&&(Module._ext_toggle_fullscreen(),closeCfg(),Module.canvas.dispatchEvent(new Event("resize")))})}function closeCfg(){cfgModal.hidden=!0,cfgModal.style.display="none"}function force_rmdir(e){FS.readdir(e).forEach((function(n){if("."!==n&&".."!==n){var l=e+"/"+n;FS.analyzePath(l).object.isFolder?(force_rmdir(l),FS.rmdir(l)):FS.unlink(l)}}))}function delete_saved_games(){console.log("INFO: try to clear `/home/web_user/saved_games`");var e=FS.readdir(saved_games_path),n=!1;for(i in e){var l=e[i];if("."!=l&&".."!=l){var t=saved_games_path+"/"+l;if(FS.analyzePath(t).object.isFolder){try{force_rmdir(t)}catch(e){console.log(e),n=!0}try{FS.rmdir(t)}catch(e){console.log(e),n=!0}}}}return n}document.getElementById("canvas").addEventListener("mouseenter",(function(e){window.focus()})),document.getElementById("canvas").addEventListener("click",(function(e){window.focus()})),window.onload=function(){window.focus()},gearBtn.onclick=function(){cfgModal.hidden=!1,cfgModal.style.display="block"},cfgClose.onclick=closeCfg,cfgModal.onclick=function(e){e.target==cfgModal&&closeCfg()},btnClearPF.onclick=function(){window.confirm("Are you sure you want to delete all saved game files and config files?")&&(delete_saved_games()?alert("Some errors ocurred when removing files, try again after reloading the game web page."):(Module.FS_syncfs(!1,(function(e){})),alert("Files removed sucessfully.")))};var ctrlsElement=document.getElementById("controls");function writeMsgOnCanvas(e){document.getElementById("textmsgs").innerHTML=e}function hideAll(){btnToggleFS.disabled=!1,closeCfg(),ctrlsElement.hidden=!0,ctrlsElement.style.display="none",bcupElement.hidden=!0,bcupElement.style.display="none",writeMsgOnCanvas("")}function mountSavedGamesDir(e){console.log("INFO: try to mount `/home/web_user/saved_games`"),Module.FS_mkdir(saved_games_path),Module.FS_mount(IDBFS,{},saved_games_path),Module.FS_syncfs(!0,e)}function doPostRun(){initializeFullscreenControlHandling(),mountSavedGamesDir((function(){if("undefined"!=typeof gamefiles){file_total_count=gamefiles.length;for(var e=0;e<file_total_count;e++)if("winsetup.exe"!==gamefiles[e]&&(gamefiles[e].endsWith(".exe")||gamefiles[e].endsWith(".ags"))){game_file=gamefiles[e];break}bcupElement.className="bluecup levitate",bcupElement.hidden=!1,function e(n){file_being_loaded=n,writeMsgOnCanvas("loading "+n+"...");var l=new XMLHttpRequest;l.open("GET",n,!0),l.responseType="arraybuffer",l.onprogress=function(e){e.lengthComputable&&writeMsgOnCanvas("loading "+file_being_loaded+" "+Math.round(e.loaded/e.total*100)+"% ...")},l.onload=function(n){var t=l.response;if(t){var a=new Uint8Array(t);Module.FS_createDataFile("/",gamefiles[file_read_count],a,!0,!0,!0),(file_read_count+=1)===file_total_count?(hideAll(),Module.callMain(["/"+game_file,"--windowed"])):e(gamefiles[file_read_count])}},l.send(null)}(gamefiles[0])}}))}function agsAttachFileInput(e){if("undefined"==typeof gamefiles&&0!==e.files.length){file_total_count=e.files.length;for(var n=0;n<file_total_count;n++)if("winsetup.exe"!==e.files[n].name&&(e.files[n].name.endsWith(".exe")||e.files[n].name.endsWith(".ags"))){game_file=e.files[n];break}file_read_count=0,0===file_reader_fr&&(file_reader_fr=new FileReader),file_reader_fr.onload=function(){fileresulthere=file_reader_fr.result;var n=new Uint8Array(fileresulthere);Module.FS_createDataFile("/",e.files[file_read_count].name,n,!0,!0,!0),(file_read_count+=1)===file_total_count?(hideAll(),Module.callMain(["/"+game_file.name,"--windowed"])):file_reader_fr.readAsArrayBuffer(e.files[file_read_count])},file_reader_fr.readAsArrayBuffer(e.files[0])}}"undefined"==typeof gamefiles&&(file_reader_fr=0,ctrlsElement.hidden=!1),window.addEventListener("orientationchange",(function(){Module.canvas.dispatchEvent(new Event("resize"))}),!1)</script><script>function getPrettyTime(){var t=new Date;function e(t,e){for(;t.toString().length<e;)t="0"+t;return t}return e(t.getHours(),2)+":"+e(t.getMinutes(),2)+":"+e(t.getSeconds(),2)+":"+e(t.getMilliseconds(),3)}var statusElement=document.getElementById("status"),bcupElement=document.getElementById("bcup"),Module={arguments:[],preRun:[],postRun:[doPostRun],print:function(t){arguments.length>1&&(t=Array.prototype.slice.call(arguments).join(" "));var e=getPrettyTime()+": "+t;console.log(e)},printErr:function(t){arguments.length>1&&(t=Array.prototype.slice.call(arguments).join(" ")),console.error(t)},canvas:function(){var t=document.getElementById("canvas");return window.addEventListener("resize",(function(t){""!==game_file&&(clearTimeout(t_rs_id),t_rs_id=setTimeout((function(){var t=Module._ext_gfxmode_get_width(),e=Module._ext_gfxmode_get_height();Module.canvas.width==t&&Module.canvas.height==e||(Module.canvas.width=t,Module.canvas.height=e,Module.canvas.style.width=t+"px",Module.canvas.style.height=e+"px",Module.canvas.dispatchEvent(new Event("resize")))}),200))}),!0),t.addEventListener("webglcontextlost",(function(t){alert("WebGL context lost. You will need to reload the page."),t.preventDefault()}),!1),t}(),setStatus:function(t){if(Module.setStatus.last||(Module.setStatus.last={time:Date.now(),text:""}),t!==Module.setStatus.last.text){var e=t.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/),n=Date.now();writeMsgOnCanvas(t),e&&n-Module.setStatus.last.time<30||(Module.setStatus.last.time=n,Module.setStatus.last.text=t,e&&(t=e[1]),statusElement.innerHTML=t)}},totalDependencies:0,monitorRunDependencies:function(t){bcupElement.hidden=!t,this.totalDependencies=Math.max(this.totalDependencies,t),Module.setStatus(t?"Preparing... ("+(this.totalDependencies-t)+"/"+this.totalDependencies+")":"All downloads complete.")}};Module.setStatus("Downloading..."),window.onerror=function(t){statusElement.style["z-index"]=1001,Module.setStatus("Exception thrown, see JavaScript console"),bcupElement.style.display="none",Module.setStatus=function(t){t&&Module.printErr("[post-exception status] "+t)}}</script><script src=ags.js async></script></body></html>