diff options
| author | raysan5 <[email protected]> | 2021-09-03 15:17:28 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2021-09-03 15:17:28 +0200 |
| commit | a1d7f54924ca795aabb5873f8e4ff5f8bc67cd9f (patch) | |
| tree | 3b2f0973987f7f5e2fd9ec8ffbcb17e801cf7445 /games | |
| parent | 9d04210f4a05ff2deafdbafc536032bc15910081 (diff) | |
| download | raylib.com-a1d7f54924ca795aabb5873f8e4ff5f8bc67cd9f.tar.gz raylib.com-a1d7f54924ca795aabb5873f8e4ff5f8bc67cd9f.zip | |
Reviewed paths
Diffstat (limited to 'games')
| -rw-r--r-- | games/classics/loader.html (renamed from games/loader.html) | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/games/loader.html b/games/classics/loader.html index e327bc7..d545f6f 100644 --- a/games/loader.html +++ b/games/classics/loader.html @@ -27,10 +27,10 @@ <style type="text/css"> @font-face { font-family: 'grixel_acme_7_wide_xtnd'; - src: url('../common/font/acme_7_wide_xtnd.eot'); - src: url('../common/font/acme_7_wide_xtnd.eot?#iefix') format('embedded-opentype'), - url('../common/font/acme_7_wide_xtnd.woff') format('woff'), - url('../common/font/acme_7_wide_xtnd.ttf') format('truetype'); + src: url('../../common/font/acme_7_wide_xtnd.eot'); + src: url('../../common/font/acme_7_wide_xtnd.eot?#iefix') format('embedded-opentype'), + url('../../common/font/acme_7_wide_xtnd.woff') format('woff'), + url('../../common/font/acme_7_wide_xtnd.ttf') format('truetype'); font-weight: normal; font-style: normal; font-size-adjust:0.49; @@ -66,8 +66,9 @@ document.title = "raylib - " + name.replace('_', ' '); - var codeUrl = 'https://github.com/raysan5/raylib-games/blob/master/classics/src/' + name.substring(9) + '.c'; - var imageUrl = 'img/' + name + '.png'; + // Get the file name from game name: classic_snake -> snake + var codeUrl = 'https://github.com/raysan5/raylib-games/blob/master/classics/src/' + name.substring(8) + '.c'; + var imageUrl = '../img/' + name + '.png'; // #sampledata filling code: canvas sample and image $('#sampledata').append( @@ -80,13 +81,30 @@ Module.canvas = document.getElementById('canvas'); Module.canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false); - var jsUrl = 'classics/' + name.substring(9) + '.js'; + var jsUrl = name.substring(8) + '.js'; // Run emscripten example $.getScript(jsUrl, function(){}); }); </script> - + <script type='text/javascript' src="https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js/dist/FileSaver.min.js"> </script> + <script type='text/javascript'> + function saveFileFromMEMFSToDisk(memoryFSname, localFSname) // This can be called by C/C++ code + { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + var data = FS.readFile(memoryFSname); + var blob; + + if (isSafari) blob = new Blob([data.buffer], { type: "application/octet-stream" }); + else blob = new Blob([data.buffer], { type: "application/octet-binary" }); + + // NOTE: SaveAsDialog is a browser setting. For example, in Google Chrome, + // in Settings/Advanced/Downloads section you have a setting: + // 'Ask where to save each file before downloading' - which you can set true/false. + // If you enable this setting it would always ask you and bring the SaveAsDialog + saveAs(blob, localFSname); + } + </script> </head> <body> |
