diff options
author | Rafal Chlodnicki <rchlodnicki@opera.com> | 2010-01-24 10:49:59 +0800 |
---|---|---|
committer | Ben Firshman <ben@firshman.co.uk> | 2010-04-25 07:50:12 +0800 |
commit | 369cf729d368ff11e03af5c47bc57df2207da446 (patch) | |
tree | df03dc91b6f9741bd868873bc6e21a4f9f2258d8 | |
parent | 1ce9207294e104501307609fdfae17d48e4b0d2c (diff) | |
download | jsnes-369cf729d368ff11e03af5c47bc57df2207da446.zip jsnes-369cf729d368ff11e03af5c47bc57df2207da446.tar.gz jsnes-369cf729d368ff11e03af5c47bc57df2207da446.tar.bz2 |
* preventDefault in keypress to cancel default action in Opera
-rw-r--r-- | js/keyboard.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/js/keyboard.js b/js/keyboard.js index 73594d5..2fddfa5 100644 --- a/js/keyboard.js +++ b/js/keyboard.js @@ -1,7 +1,7 @@ function Keyboard() { this.keys = {KEY_A: 0, KEY_B: 1, KEY_SELECT: 2, KEY_START: 3, KEY_UP: 4, KEY_DOWN: 5, KEY_LEFT: 6, KEY_RIGHT: 7}; - + this.state1 = Array(8); for (var i = 0; i < this.state1.length; i++) this.state1[i] = 0x40; this.state2 = Array(8); @@ -36,6 +36,9 @@ Keyboard.prototype.keyDown = function(evt) { if (!this.setKey(evt.keyCode, 0x41) && evt.preventDefault) evt.preventDefault(); } +Keyboard.prototype.keyPress = function(evt) { + evt.preventDefault(); +} Keyboard.prototype.keyUp = function(evt) { if (!this.setKey(evt.keyCode, 0x40) && evt.preventDefault) evt.preventDefault(); |