mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Minor fixes
This commit is contained in:
parent
0a1127f541
commit
8a761be9a9
@ -83,6 +83,7 @@ function initAudio() {
|
||||
io.floatAudio(16000);
|
||||
audioMoz = true;
|
||||
} else {
|
||||
debug("Using audio elements");
|
||||
audio2 = document.createElement("audio");
|
||||
}
|
||||
}
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -*- mode: JavaScript; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* Copyright 2010 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2013 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* 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;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -*- mode: JavaScript; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* Copyright 2010 Will Scullin <scullin@scullinsteel.com>
|
||||
/* Copyright 2010-2013 Will Scullin <scullin@scullinsteel.com>
|
||||
*
|
||||
* 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('<div class="clear" />');
|
||||
}
|
||||
kb.append('<div class="clear" />');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user