The "Gamepad Tester" is an application designed to verify and test the functionality of gamepads across different operating systems. It provides a simple and intuitive interface to check if gamepads are functioning correctly, ensuring all buttons and axes are responsive as expected.
This project was created using the following technologies:
- Tailwind CSS for styling.
- Next.js for building React applications with server-side rendering.
- The Gamepad API for interacting with gamepad devices.
The recognition of the gamepad is achieved through the following code snippet:
window.addEventListener("gamepadconnected", (event) => {
// All buttons and axes values can be accessed through
const gamepad = event.gamepad;
});
Additionally, there is a loop using setInterval to continuously listen for button actions:
setInterval(() => {
setGamepadInstance(
navigator.getGamepads()[gamepad.index]
);
}, 15);
Feel free to fork and use as you want.