8000
  • Add gamepad support by davidspies · Pull Request #599 · not-fl3/miniquad · GitHub
    [go: up one dir, main page]

    Skip to content

    Add gamepad support - #599

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

    davidspies wants to merge 2 commits into
    not-fl3:masterfrom
    davidspies:controller-support

    Conversation

    @davidspies
    Copy link
    Copy Markdown

    What it says on the tin

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

    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.

    Comment thread js/gl.js Resolved
    Comment thread js/gl.js Resolved
    Comment thread js/gl.js Resolved
    Comment thread js/gl.js Resolved
    @not-fl3
    not-fl3 commented Jan 9, 2026
    Copy link
    Copy Markdown
    Owner

    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
    Copy Markdown
    Author

    Okay

    @davidspies davidspies closed this Jan 9, 2026
    This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
    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.

    3 participants

    0