summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--common/games.js2
-rw-r--r--games.html2
-rw-r--r--games/classics/loader.html (renamed from games/loader.html)34
3 files changed, 28 insertions, 10 deletions
diff --git a/common/games.js b/common/games.js
index e5110ca..2570fb5 100644
--- a/common/games.js
+++ b/common/games.js
@@ -53,7 +53,7 @@ $(document).ready(function() {
var linkTag;
- if (filterType == 'classic') linkTag = '<a class="fancybox fancybox.iframe" href="games/loader.html?name=' + exampleName[i] + '" title="' + exampleDesc[i] + '">';
+ if (filterType == 'classic') linkTag = '<a class="fancybox fancybox.iframe" href="games/classics/loader.html?name=' + exampleName[i] + '" title="' + exampleDesc[i] + '">';
else if (filterType == 'game') linkTag = '<a target="_blank" href="games/' + exampleName[i].substring(5) + '.html" title="' + exampleDesc[i] + '">';
$('#container').append(
diff --git a/games.html b/games.html
index 254a7d8..21067e9 100644
--- a/games.html
+++ b/games.html
@@ -65,7 +65,7 @@
<p>raylib games are organized in two categories:</p>
<br>
<div id="filter_menu">
- <div class="filter legendButton" id="classic" data-filter=".fsample">classic games</div>
+ <div class="filter legendButton" id="classic" data-filter=".fclassic">classic games</div>
<div class="filter legendButton" id="game" data-filter=".fgame">standard games</div>
<!--<div class="filter legendButton" id="user" data-filter=".fuser">users games</div>-->
</div>
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>