general fixes
This commit is contained in:
parent
c571069b2f
commit
0a59840516
@ -12,7 +12,7 @@
|
|||||||
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
|
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="gamepad white"></div>
|
<div class="gamepad"></div>
|
||||||
|
|
||||||
<script src="js/vendor/jquery-2.2.3.min.js"></script>
|
<script src="js/vendor/jquery-2.2.3.min.js"></script>
|
||||||
<script src="js/gamepad.js"></script>
|
<script src="js/gamepad.js"></script>
|
||||||
|
@ -1,13 +1,22 @@
|
|||||||
|
$.urlParam = function(name) {
|
||||||
|
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
|
||||||
|
if (results === null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return decodeURIComponent(results[1]) || 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var haveEvents = 'ongamepadconnected' in window;
|
var haveEvents = 'ongamepadconnected' in window;
|
||||||
var gamepads = {};
|
var gamepads = {};
|
||||||
var $gamepad = $('.gamepad');
|
var $gamepad = $('.gamepad');
|
||||||
var gamepadIdentifiers = {
|
var gamepadIdentifiers = {
|
||||||
'ds4': {
|
'ds4': {
|
||||||
'id': /Vendor: 054c Product: 05c4/,
|
'id': /054c.*?05c4/,
|
||||||
'colors': ['black', 'white', 'red', 'blue']
|
'colors': ['black', 'white', 'red', 'blue']
|
||||||
},
|
},
|
||||||
'xbox-one': {
|
'xbox-one': {
|
||||||
'id': /XInput/,
|
'id': /xinput|XInput/,
|
||||||
'colors': ['black', 'white']
|
'colors': ['black', 'white']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -130,6 +139,10 @@ function updateVisualStatus() {
|
|||||||
var gamepads = getGamepads();
|
var gamepads = getGamepads();
|
||||||
var activeGamepad = gamepads[activeGamepadIndex];
|
var activeGamepad = gamepads[activeGamepadIndex];
|
||||||
|
|
||||||
|
if (!activeGamepad) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var button;
|
var button;
|
||||||
var $button;
|
var $button;
|
||||||
for (var buttonIndex = 0; buttonIndex < activeGamepad.buttons.length; buttonIndex++) {
|
for (var buttonIndex = 0; buttonIndex < activeGamepad.buttons.length; buttonIndex++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user