added a "no gamepad detected" indication

This commit is contained in:
e7d 2016-11-11 01:32:07 +01:00
parent f0e4d20513
commit 8a342d60ec
3 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,13 @@ body {
background: transparent;
overflow: hidden;
}
.no-gamepad {
width: 100vw;
line-height: 100vh;
text-align: center;
text-transform: uppercase;
font-weight: 700;
}
.gamepad {
position: absolute;
top: 50%;

View File

@ -11,6 +11,7 @@
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div class="no-gamepad">No gamepad detected</div>
<div class="gamepad"></div>
<div class="help">
<h2>Help</h2>

View File

@ -93,7 +93,7 @@ function scanGamepads() {
return;
}
var gamepads = getGamepads();
gamepads = getGamepads();
for (var gamepadIndex = 0; gamepadIndex < gamepads.length; gamepadIndex++) {
var gamepad = gamepads[gamepadIndex];
if (gamepad) {