Skip to content

Add gamepad support#599

Closed
davidspies wants to merge 2 commits intonot-fl3:masterfrom
davidspies:controller-support
Closed

Add gamepad support#599
davidspies wants to merge 2 commits intonot-fl3:masterfrom
davidspies:controller-support

Conversation

@davidspies
Copy link

What it says on the tin

Copilot AI review requested due to automatic review settings January 8, 2026 20:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds gamepad support by implementing bindings to the W3C Gamepad API. It provides functions to query the number of connected gamepads, check connection status, read button states, and read analog axis values.

  • Adds Rust FFI declarations for gamepad functions in the WASM native module
  • Implements corresponding JavaScript functions that interface with the browser's Gamepad API
  • Supports up to 4 gamepads with standard button/axis mappings

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/native/wasm.rs Adds extern "C" declarations for four gamepad-related functions with documentation
js/gl.js Implements the JavaScript gamepad functions that query the browser's navigator.getGamepads() API

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@not-fl3
Copy link
Owner

not-fl3 commented Jan 9, 2026

I would rather keep it in a pluging instead of adding it to core miniquad.

For native platforms I used https://github.com/not-fl3/quad-gamepad, but there are so many different ways to communicate with gamepads and its all so opionated.

I would consider just starting a new miniquad JS plugin crate with the implementation proposed in this PR.

@davidspies
Copy link
Author

Okay

@davidspies davidspies closed this Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants