Skip to content

Commit

Permalink
Add no controller meesage
Browse files Browse the repository at this point in the history
  • Loading branch information
pmanikas committed Nov 20, 2024
1 parent 09d4c2a commit 38735d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ function updateControllerState(gamepad: Gamepad): void {
}
}
// set translate x and y pairs for each stick. Array values come in pairs, first the first 2 then the other 2 and so on


});
}

Expand Down Expand Up @@ -172,12 +170,12 @@ function stop(): void {

function resetDOM(): void {
controllerName.textContent = 'No controller connected';
controllerDisplay.innerHTML = '';
controllerDisplay.innerHTML = 'Please connect your bluetooth controller!';
document.querySelector('.svg-container').innerHTML = '';
document.querySelector('.vibrate-button')?.remove();
}

window.addEventListener('gamepadconnected', start);
window.addEventListener('gamepaddisconnected', stop);
window.addEventListener('beforeunload', stop);
window.addEventListener('unload', stop);
window.addEventListener('unload', stop);
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<body>
<h1>Game Controller Tester</h1>
<div id="controller-info">
<h2 id="controller-name">No controller connected</h2>
<div id="controller-display"></div>
<h2 id="controller-name">No controller detected.</h2>
<div id="controller-display">Please connect your bluetooth controller!</div>
</div>
<div class="svg-container"></div>
<script src="app.js"></script>
Expand Down

0 comments on commit 38735d2

Please sign in to comment.