aboutsummaryrefslogtreecommitdiff
path: root/projects/chip8emu
diff options
context:
space:
mode:
Diffstat (limited to 'projects/chip8emu')
-rw-r--r--projects/chip8emu/index.html3
-rw-r--r--projects/chip8emu/module.js28
2 files changed, 5 insertions, 26 deletions
diff --git a/projects/chip8emu/index.html b/projects/chip8emu/index.html
index e875a05..9f34340 100644
--- a/projects/chip8emu/index.html
+++ b/projects/chip8emu/index.html
@@ -2,6 +2,7 @@
title: CHIP8Emu
layout: project
---
+
<h3>CHIP8Emu</h3>
<p>An emulator for CHIP-8 written in C++</p>
@@ -12,6 +13,8 @@ layout: project
<progress value="0" max="100" id="progress" hidden=0></progress>
<canvas id="canvas" oncontextmenu="event.preventDefault()" tabindex=0></canvas>
+<button class="chip8-button">Q</button>
+
<script type="text/javascript" src="module.js"></script>
<script async type="text/javascript" src="chip8emu.js"></script>
diff --git a/projects/chip8emu/module.js b/projects/chip8emu/module.js
index 711736e..851257a 100644
--- a/projects/chip8emu/module.js
+++ b/projects/chip8emu/module.js
@@ -48,14 +48,10 @@ var Module = {
monitorRunDependencies: (left) => {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
- },
- simulateKeyPressE: function() {
- var canvas = document.getElementById('canvas');
- canvas.focus();
-
- canvas.dispatchEvent(new KeyboardEvent('keydown', { 'key': 'e', 'code': 'KeyE', 'keyCode': 82 }));
}
};
+
+
Module.setStatus('Downloading...');
window.onerror = () => {
Module.setStatus('Exception thrown, see JavaScript console');
@@ -63,23 +59,3 @@ window.onerror = () => {
if (text) console.error('[post-exception status] ' + text);
};
};
-
-document.addEventListener("keydown", (function(e) {
- var t = document.getElementById("canvas"),
- n = new KeyboardEvent("keydown", {
- key: e.key,
- code: e.code,
- keyCode: e.keyCode
- });
- t.dispatchEvent(n)
-}))
-
-document.addEventListener("keyup", (function(e) {
- var t = document.getElementById("canvas"),
- n = new KeyboardEvent("keyup", {
- key: e.key,
- code: e.code,
- keyCode: e.keyCode
- });
- t.dispatchEvent(n)
-}))