Skip to content

Commit 098fa7f

Browse files
committed
Add support for web
1 parent 0745ad6 commit 098fa7f

File tree

4 files changed

+10621
-1
lines changed

4 files changed

+10621
-1
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ run_web:
1818
emrun rimuru.html
1919

2020
clean:
21-
rm -rf rimuru* || true
21+
rm -rf rimuru || true
2222

2323
update_homepage: web
2424
cp rimuru.html index.html

rimuru.html

+240
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
<!doctype html>
2+
<html lang="en-us">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6+
7+
<title>raylib HTML5 GAME</title>
8+
9+
<meta name="title" content="raylib HTML5 GAME">
10+
<meta name="description" content="New HTML5 videogame, developed using raylib videogames library">
11+
<meta name="keywords" content="raylib, games, html5, programming, C, C++, library, learn, videogames">
12+
<meta name="viewport" content="width=device-width">
13+
14+
<!-- Facebook metatags for sharing -->
15+
<meta property="og:title" content="raylib HTML5 GAME">
16+
<meta property="og:image:type" content="image/png">
17+
<meta property="og:image" content="http://www.raylib.com/img/raylib_logo.png">
18+
<meta property="og:image" content="http://www.raylib.com/img/raylib_logo.png">
19+
<meta property="og:url" content="http://www.raylib.com/games">
20+
<meta property="og:site_name" content="raylib.com">
21+
<meta property="og:description" content="New hmtl5 videogame, developed using raylib videogames library">
22+
23+
<meta name="twitter:card" content="summary">
24+
<meta name="twitter:site" content="@emegemegames">
25+
<meta name="twitter:title" content="raylib HTML5 GAME">
26+
<meta name="twitter:description" content="New HTML5 videogame, developed using raylib videogames library">
27+
<meta name="twitter:image" content="http://www.raylib.com/img/raylib_logo.png">
28+
<meta name="twitter:url" content="http://www.raylib.com/img/raylib_logo.png">
29+
30+
<!--<link rel="stylesheet" href="./Koala Seasons by emegeme_files/main.css">-->
31+
<link rel="shortcut icon" href="http://www.raylib.com/favicon.ico">
32+
33+
<style>
34+
body {
35+
font-family: arial;
36+
margin: 0;
37+
padding: none;
38+
}
39+
40+
#header_part {
41+
width: 100%;
42+
height: 80px;
43+
background-color: #888888;
44+
}
45+
46+
#logo {
47+
width:64px;
48+
height:64px;
49+
float:left;
50+
position:relative;
51+
margin:10px;
52+
background-image:url(http://www.raylib.com/img/raylib_logo64x64.png);
53+
}
54+
55+
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
56+
div.emscripten { text-align: center; }
57+
div.emscripten_border { border: 1px solid black; }
58+
59+
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
60+
canvas.emscripten { border: 0px none; }
61+
62+
#emscripten_logo {
63+
display: inline-block;
64+
margin: 0;
65+
}
66+
67+
.spinner {
68+
height: 30px;
69+
width: 30px;
70+
margin: 0;
71+
margin-top: 20px;
72+
margin-left: 20px;
73+
display: inline-block;
74+
vertical-align: top;
75+
-webkit-animation: rotation .8s linear infinite;
76+
-moz-animation: rotation .8s linear infinite;
77+
-o-animation: rotation .8s linear infinite;
78+
animation: rotation 0.8s linear infinite;
79+
border-left: 5px solid black;
80+
border-right: 5px solid black;
81+
border-bottom: 5px solid black;
82+
border-top: 5px solid red;
83+
84+
border-radius: 100%;
85+
background-color: rgb(245, 245, 245);
86+
}
87+
@-webkit-keyframes rotation {
88+
from {-webkit-transform: rotate(0deg);}
89+
to {-webkit-transform: rotate(360deg);}
90+
}
91+
@-moz-keyframes rotation {
92+
from {-moz-transform: rotate(0deg);}
93+
to {-moz-transform: rotate(360deg);}
94+
}
95+
@-o-keyframes rotation {
96+
from {-o-transform: rotate(0deg);}
97+
to {-o-transform: rotate(360deg);}
98+
}
99+
@keyframes rotation {
100+
from {transform: rotate(0deg);}
101+
to {transform: rotate(360deg);}
102+
}
103+
104+
#status {
105+
display: inline-block;
106+
vertical-align: top;
107+
margin-top: 30px;
108+
margin-left: 20px;
109+
font-weight: bold;
110+
color: rgb(40, 40, 40);
111+
}
112+
113+
#progress {
114+
height: 20px;
115+
width: 30px;
116+
}
117+
118+
#controls {
119+
display: inline-block;
120+
float: right;
121+
vertical-align: top;
122+
margin-top: 30px;
123+
margin-right: 20px;
124+
}
125+
126+
#output {
127+
width: 100%;
128+
height: 140px;
129+
margin: 0 auto;
130+
margin-top: 10px;
131+
display: block;
132+
background-color: black;
133+
color: rgb(37, 174, 38);
134+
font-family: 'Lucida Console', Monaco, monospace;
135+
outline: none;
136+
}
137+
</style>
138+
</head>
139+
<body>
140+
<div id="header_part">
141+
<a id="logo" href="http://www.raylib.com"></a>
142+
143+
<div class="spinner" id='spinner'></div>
144+
<div class="emscripten" id="status">Downloading...</div>
145+
146+
<span id='controls'>
147+
<span><input type="button" value="Fullscreen" onclick="Module.requestFullScreen(false, false)"></span>
148+
</span>
149+
150+
<div class="emscripten">
151+
<progress value="0" max="100" id="progress" hidden=1></progress>
152+
</div>
153+
</div>
154+
155+
<div class="emscripten_border">
156+
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
157+
</div>
158+
159+
<textarea id="output" rows="8"></textarea>
160+
161+
<script type='text/javascript'>
162+
var statusElement = document.getElementById('status');
163+
var progressElement = document.getElementById('progress');
164+
var spinnerElement = document.getElementById('spinner');
165+
var Module = {
166+
preRun: [],
167+
postRun: [],
168+
print: (function() {
169+
var element = document.getElementById('output');
170+
if (element) element.value = ''; // clear browser cache
171+
return function(text) {
172+
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
173+
// These replacements are necessary if you render to raw HTML
174+
//text = text.replace(/&/g, "&amp;");
175+
//text = text.replace(/</g, "&lt;");
176+
//text = text.replace(/>/g, "&gt;");
177+
//text = text.replace('\n', '<br>', 'g');
178+
console.log(text);
179+
if (element) {
180+
element.value += text + "\n";
181+
element.scrollTop = element.scrollHeight; // focus on bottom
182+
}
183+
};
184+
})(),
185+
printErr: function(text) {
186+
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
187+
if (0) { // XXX disabled for safety typeof dump == 'function') {
188+
dump(text + '\n'); // fast, straight to the real console
189+
} else {
190+
console.error(text);
191+
}
192+
},
193+
canvas: (function() {
194+
var canvas = document.getElementById('canvas');
195+
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
196+
// application robust, you may want to override this behavior before shipping!
197+
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
198+
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
199+
return canvas;
200+
})(),
201+
setStatus: function(text) {
202+
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
203+
if (text === Module.setStatus.text) return;
204+
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
205+
var now = Date.now();
206+
if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon
207+
if (m) {
208+
text = m[1];
209+
progressElement.value = parseInt(m[2])*100;
210+
progressElement.max = parseInt(m[4])*100;
211+
progressElement.hidden = false;
212+
spinnerElement.hidden = false;
213+
} else {
214+
progressElement.value = null;
215+
progressElement.max = null;
216+
progressElement.hidden = true;
217+
if (!text) spinnerElement.style.display = 'none';
218+
}
219+
statusElement.innerHTML = text;
220+
},
221+
totalDependencies: 0,
222+
monitorRunDependencies: function(left) {
223+
this.totalDependencies = Math.max(this.totalDependencies, left);
224+
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
225+
}
226+
};
227+
Module.setStatus('Downloading...');
228+
window.onerror = function(event) {
229+
// TODO: do not warn on ok events like simulating an infinite loop or exitStatus
230+
Module.setStatus('Exception thrown, see JavaScript console');
231+
spinnerElement.style.display = 'none';
232+
Module.setStatus = function(text) {
233+
if (text) Module.printErr('[post-exception status] ' + text);
234+
};
235+
};
236+
</script>
237+
<script async type="text/javascript" src="rimuru.js"></script>
238+
</body>
239+
</html>
240+

0 commit comments

Comments
 (0)