-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
231 lines (206 loc) · 8.68 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>A-Frame JSNES: WebVR NES emulator</title>
</head>
<!-- <script src="lib/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script> -->
<script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://rawgit.com/donmccurdy/aframe-extras/v2.2.0/dist/aframe-extras.loaders.min.js"></script>
<!-- for menu overlay -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<style>
.intro-overlay {
z-index: 1;
position: absolute;
top: 20px;
left: 20px;
max-width: 350px;
box-sizing: border-box;
padding: 1.5em;
color: #FFF;
background: rgba(0, 0, 0, 0.75);
font-family: Source Sans Pro, Helvetica Neue, Helvetica, Arial, sans-serif;
}
.menu-overlay {
z-index: 99999;
position: fixed;
top: 20px;
right: 20px;
box-sizing: border-box;
padding: 1.5em;
width: 60px;
height: 60px;
padding-bottom: 0px;
background: rgba(0, 0, 0, 0.5) url(./images/hamburger-white.png) center no-repeat;
background-size: 40px 40px;
font-family: Source Sans Pro, Helvetica Neue, Helvetica, Arial, sans-serif;
}
.menu-overlay:hover {
background: rgba(0, 0, 0, 0.2) url(./images/hamburger-white.png) center no-repeat;
background-size: 40px 40px;
}
</style>
<body>
<a-scene>
<a-assets>
<canvas id="tvSnowCanvas" width="256" height="256"></canvas>
<canvas id="nes-screen" class="nes-screen" width="256" height="240"></canvas>
<a-asset-item id="nesRoomPly" src="assets/room-notv.bake.ply"></a-asset-item>
<a-asset-item id="tvNES" src="assets/tv-nes.bake.ply"></a-asset-item>
<img id="nightSky" src="assets/24564695173_4f8f0ab4ab_o.jpg">
</a-assets>
<a-entity id="cameraWrapper" rotation="0 180 0">
<a-entity id="camera" camera look-controls></a-entity>
</a-entity>
<a-video id="nesScreen" src="#nes-screen" width="4" height="3" position="1.25 -0.87 18.48" rotation="0 180 0" scale="0.92 0.92 0.92"></a-video>
<a-plane id="tvSnow" src="#tvSnowCanvas" width="4" height="3" position="1.25 -0.87 18.46" rotation="0 180 0" scale="0.92 0.92 0.92"></a-plane>
<!-- rotation was -90 0 130 -->
<a-plane id="backWall" color="black" width="20" height="20" position="1.25 -0.89 22" rotation="0 180 0" scale="1.32 1.40 1"></a-plane>
<a-plane id="ceiling" color="black" width="20" height="20" position="0.86 12.71 6.44" rotation="90 180 0" scale="1.32 1.68 1"></a-plane>
<a-entity ply-model="src: #nesRoomPly" position="1 -4 6.5" scale=".25 .25 .25" rotation="-90 0 0"></a-entity>
<a-entity ply-model="src: #tvNES" position="-1.5 -3.5 19.5" scale=".25 .25 .25" rotation="-90 0 0"></a-entity>
<a-sky src="#nightSky" rotation="0 -208 0"></a-sky>
</a-scene>
<!-- tv snow http://jsfiddle.net/AbdiasSoftware/dEya9/ http://stackoverflow.com/questions/22003491/animating-canvas-to-look-like-tv-noise -->
<script>
var canvas = document.getElementById('tvSnowCanvas'),
ctx = canvas.getContext('2d');
function noise(ctx) {
var w = ctx.canvas.width,
h = ctx.canvas.height,
idata = ctx.createImageData(w, h),
buffer32 = new Uint32Array(idata.data.buffer),
len = buffer32.length,
i = 0;
for(; i < len;)
buffer32[i++] = ((255 * Math.random())|0) << 24;
ctx.putImageData(idata, 0, 0);
}
var toggle = true;
// added toggle to get 30 FPS instead of 60 FPS
(function loop() {
toggle = !toggle;
if (toggle) {
requestAnimationFrame(loop);
return;
}
noise(ctx);
requestAnimationFrame(loop);
})();
</script>
<div id="bloc" class="img-rounded intro-overlay">
<h4><strong>A-Frame JSNES</strong></h4>
<div id="emulator"></div>
<h4>Controls</h4>
<table id="controls">
<tr>
<th>Button</th>
<th>Player 1</th>
<th>Player 2</th>
</tr>
<tr>
<td>Left</td>
<td>Left</td>
<td>Num-4</td>
<tr>
<td>Right</td>
<td>Right</td>
<td>Num-6</td>
</tr>
<tr>
<td>Up</td>
<td>Up</td>
<td>Num-8</td>
</tr>
<tr>
<td>Down</td>
<td>Down</td>
<td>Num-2</td>
</tr>
<tr>
<td>A</td>
<td>X</td>
<td>Num-7</td>
</tr>
<tr>
<td>B</td>
<td>Z/Y</td>
<td>Num-9</td>
</tr>
<tr>
<td>Start</td>
<td>Enter</td>
<td>Num-1</td>
</tr>
<tr>
<td>Select</td>
<td>Ctrl</td>
<td>Num-3</td>
</tr>
</table>
</div>
<script src="lib/dynamicaudio-min.js" type="text/javascript" charset="utf-8"></script>
<script src="source/nes.js" type="text/javascript" charset="utf-8"></script>
<script src="source/utils.js" type="text/javascript" charset="utf-8"></script>
<script src="source/cpu.js" type="text/javascript" charset="utf-8"></script>
<script src="source/keyboard.js" type="text/javascript" charset="utf-8"></script>
<script src="source/mappers.js" type="text/javascript" charset="utf-8"></script>
<script src="source/papu.js" type="text/javascript" charset="utf-8"></script>
<script src="source/ppu.js" type="text/javascript" charset="utf-8"></script>
<script src="source/rom.js" type="text/javascript" charset="utf-8"></script>
<script src="source/ui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var nes;
$(function() {
nes = new JSNES({
'ui': $('#emulator').JSNESUI({
"Homebrew": [
['LJ65', 'roms/lj65/lj65.nes'],
['Concentration Room', 'roms/croom/croom.nes']
],
"Working": [
['Bubble Bobble', 'local-roms/Bubble Bobble (U).nes'],
['Contra', 'local-roms/Contra (U) [!].nes'],
['Donkey Kong', 'local-roms/Donkey Kong (JU).nes'],
['Dr. Mario', 'local-roms/Dr. Mario (JU).nes'],
['Golf', 'local-roms/Golf (JU).nes'],
['The Legend of Zelda', 'local-roms/Legend of Zelda, The (U) (PRG1).nes'],
['Lemmings', 'local-roms/Lemmings (U).nes'],
['Lifeforce', 'local-roms/Lifeforce (U).nes'],
['Mario Bros.', 'local-roms/Mario Bros. (JU) [!].nes'],
['Mega Man', 'local-roms/Mega Man (U).nes'],
['Pac-Man', 'local-roms/Pac-Man (U) [!].nes'],
['Super Mario Bros.', 'local-roms/Super Mario Bros. (JU) (PRG0) [!].nes'],
['Tennis', 'local-roms/Tennis (JU) [!].nes'],
['Tetris', 'local-roms/Tetris (U) [!].nes'],
['Tetris 2', 'local-roms/Tetris 2 (U) [!].nes'],
['Zelda II - The Adventure of Link', 'local-roms/Zelda II - The Adventure of Link (U).nes']
],
"Nearly Working": [
['Duck Hunt', 'local-roms/Duck Hunt (JUE) [!].nes'],
['Super Mario Bros. 3', 'local-roms/Super Mario Bros. 3 (U) (PRG1) [!].nes']
]
})
});
});
</script>
<script type="text/javascript" charset="utf-8">
var scene = document.querySelector('a-scene');
if (scene.hasLoaded) {
run();
} else {
scene.addEventListener('loaded', run);
}
function run () {
setTimeout(function(){ // wait a few seconds before loading a rom, yes this is ghetto
$("#romSelect")[0].value = "roms/lj65/lj65.nes";
nes.ui.loadROM();
$("#tvSnow").remove();
}, 5000);
}
</script>
</body>
</html>