-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
156 lines (140 loc) · 4.61 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>2D Platformer Starter Kit (JSIL + FNA + SDL2 + Emscripten)</title>
<style>
html, body {
font-family: Fira Sans, Calibri, Tahoma, sans-serif;
margin: 0px;
padding: 0px;
background-color: black;
color: rgb(210, 210, 210);
}
a, a:visited {
color: rgb(180, 230, 255);
}
canvas {
display: block;
margin-left: auto;
margin-right: auto;
image-rendering: -moz-crisp-edges;
image-rendering: crisp-edges;
image-rendering: pixelated;
-ms-interpolation-mode: nearest-neighbor;
}
div#log {
margin-left: 8px;
margin-right: 8px;
margin-top: 16px;
}
#loadingProgress {
position: relative;
display: block;
background-color: black;
color: white;
top: 200px;
width: 600px;
text-align: center;
margin-left: auto;
margin-right: auto;
font-size: 16pt;
font-weight: bold;
border-style: solid;
border-color: white;
border-width: 2px;
border-radius: 16px;
z-index: 99;
}
#progressText {
position: absolute;
text-align: center;
text-shadow: #000000 1px 1px 0px;
overflow: hidden;
text-overflow: ellipsis;
background-color: rgba(0, 0, 0, 0.33);
border-radius: 8px;
color: white;
padding-top: 6px;
padding-bottom: 6px;
padding-left: 6px;
padding-right: 6px;
max-width: 90%;
max-height: 1.1em;
}
#progressBar {
border-radius: 16px;
background-color: rgb(127, 140, 160);
height: 60px;
margin: -1px;
padding: 0px;
}
</style>
</head>
<body onload="onLoad()" onresize="onResize()">
<script type="text/javascript">
var jsilConfig = {
libraryRoot: "../JSIL/Libraries/",
manifestRoot: "bin/JSIL/",
scriptRoot: "bin/JSIL/",
fileRoot: "bin/JSIL/",
assetRoot: "bin/JSIL/",
contentRoot: "bin/JSIL/Content/",
manifests: [
"Platformer2D.exe",
"../../Platformer2D.mgcb",
"../../SDL2.dll",
"../../soft_oal.dll"
],
readOnlyStorage: true,
showProgressBar: true
};
window.assetsToLoad = [
]
</script>
<script src="../JSIL/Libraries/JSIL.js" type="text/javascript"></script>
<script>
JSIL.ThrowOnStaticCctorError = true;
</script>
<div id="loadingProgress"></div>
<canvas id="canvas" width="800" height="480">
</canvas><br>
<div id="log">
<center><b><i>Ported with <a href="http://jsil.org/" target="_blank">JSIL</a> and <a href="http://emscripten.org/" target="_blank">Emscripten</a>. See the <a href="https://github.com/sq/SampleFNA/blob/master/README.md" target="_blank">Readme</a>.</i></b></center>
<center><i>Use the arrow keys and spacebar, or press a button on your gamepad to enable it.</i></center>
</div>
<script type="text/javascript">
function onResize () {
var canvas = document.getElementById("canvas");
var nativeWidth = canvas.width | 0;
var nativeHeight = canvas.height | 0;
var deviceRatio = window.devicePixelRatio || 1.0;
var windowNativeWidth = window.innerWidth * deviceRatio;
var windowNativeHeight = (window.innerHeight * deviceRatio) - 200 /* padding */;
var targetRatio = Math.floor(Math.min(
windowNativeWidth / nativeWidth,
windowNativeHeight / nativeHeight
));
if (targetRatio < 1)
targetRatio = 1;
var cssWidth = (nativeWidth * targetRatio / deviceRatio).toFixed(2);
var cssHeight = (nativeHeight * targetRatio / deviceRatio).toFixed(2);
canvas.style.width = cssWidth + "px";
canvas.style.height = cssHeight + "px";
}
function runMain () {
// We can't invoke Main() since it disposes the Game immediately, breaking everything.
window.asm = JSIL.GetAssembly("Platformer2D", true);
var module = JSIL.PInvoke.GetModule("SDL2.dll");
module.canvas = document.getElementById("canvas");
module.memoryInitializerPrefixURL = "/Libraries/SDL2/";
module.printErr = function(s) { console.error(s) };
window.module = module;
var game = new asm.Platformer2D.PlatformerGame();
game.Run();
onResize();
window.setTimeout(onResize, 50);
};
</script>
</body>
</html>