diff --git a/js/ui/audio.js b/js/ui/audio.js index bae56b1..18b86f2 100644 --- a/js/ui/audio.js +++ b/js/ui/audio.js @@ -83,6 +83,7 @@ function initAudio() { io.floatAudio(16000); audioMoz = true; } else { + debug("Using audio elements"); audio2 = document.createElement("audio"); } } diff --git a/js/ui/gamepad.js b/js/ui/gamepad.js index 04dffdc..702e035 100644 --- a/js/ui/gamepad.js +++ b/js/ui/gamepad.js @@ -71,25 +71,30 @@ function processGamepad(io) { for (var idx = 0; idx < gamepad.buttons.length; idx++) { val = gamepadMap[idx]; if (val !== undefined) { - if (gamepad.buttons[idx]) { - if (!gamepadState[idx]) { - if (val <= 0) { - io.buttonDown(-val); - } else { - io.keyDown(gamepadMap[idx]); - } - } + var old = gamepadState[idx]; + var button = gamepad.buttons[idx]; + var pressed; + if (typeof(button) == "object") { + pressed = button.pressed; } else { - if (gamepadState[idx]) { - if (val <= 0) { - io.buttonUp(-val); - } else { - io.keyUp(); - } + pressed = (button == 1.0); + } + + if (pressed && !old) { + if (val <= 0) { + io.buttonDown(-val); + } else { + io.keyDown(gamepadMap[idx]); + } + } else if (!pressed && old) { + if (val <= 0) { + io.buttonUp(-val); + } else { + io.keyUp(); } } + gamepadState[idx] = pressed; } - gamepadState[idx] = gamepad.buttons[idx]; } } } diff --git a/js/ui/keyboard2.js b/js/ui/keyboard2.js index b48455f..1293547 100644 --- a/js/ui/keyboard2.js +++ b/js/ui/keyboard2.js @@ -1,5 +1,5 @@ /* -*- mode: JavaScript; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* Copyright 2010 Will Scullin +/* Copyright 2010-2013 Will Scullin * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -146,7 +146,7 @@ function KeyBoard(io) { [['!','"','#','$','%','&',"'",'(',')','0','*','=','RESET'], ['ESC','Q','W','E','R','T','Y','U','I','O','@','REPT','RETURN'], ['CTRL','A','S','D','F','BELL','H','J','K','L','+','←','→'], - ['SHIFT','Z','X','C','V','B','^','M','<','>','?','SHIFT'], + ['SHIFT','Z','X','C','V','B','^',']','<','>','?','SHIFT'], ['POWER', ' ']]]; var shifted = false; diff --git a/js/ui/keyboard2e.js b/js/ui/keyboard2e.js index 5e7b96c..f5391fc 100644 --- a/js/ui/keyboard2e.js +++ b/js/ui/keyboard2e.js @@ -1,5 +1,5 @@ /* -*- mode: JavaScript; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* Copyright 2010 Will Scullin +/* Copyright 2010-2013 Will Scullin * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -374,7 +374,9 @@ function KeyBoard(io) { row.append(key); } + row.append('
'); } + kb.append('
'); } }; }