added color selection from uri
This commit is contained in:
parent
0a59840516
commit
3358782f55
@ -115,6 +115,10 @@ function mapGamepad(gamepad) {
|
||||
).done(function(template) {
|
||||
$gamepad.html(template);
|
||||
|
||||
if ($.urlParam('color')) {
|
||||
changeGamepadColor($.urlParam('color'));
|
||||
}
|
||||
|
||||
mapping.buttons = [];
|
||||
for (var buttonIndex = 0; buttonIndex < gamepad.buttons.length; buttonIndex++) {
|
||||
button = gamepad.buttons[buttonIndex];
|
||||
@ -189,11 +193,16 @@ function updateVisualStatus() {
|
||||
requestAnimationFrame(updateVisualStatus);
|
||||
}
|
||||
|
||||
function changeGamepadColor() {
|
||||
function changeGamepadColor(gamepadColor) {
|
||||
if (!! gamepadColor) {
|
||||
activeGamepadColor = gamepadColor;
|
||||
} else {
|
||||
activeGamepadColor++;
|
||||
|
||||
if (activeGamepadColor > activeGamepadIdentifier.colors.length - 1) {
|
||||
activeGamepadColor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$gamepad.attr('data-color', activeGamepadIdentifier.colors[activeGamepadColor]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user