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; background: transparent;
overflow: hidden; overflow: hidden;
} }
.no-gamepad {
width: 100vw;
line-height: 100vh;
text-align: center;
text-transform: uppercase;
font-weight: 700;
}
.gamepad { .gamepad {
position: absolute; position: absolute;
top: 50%; top: 50%;

View File

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

View File

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