libgdx / libgdx/gdx-controllers

buttonDown, buttonUp are called every frame, even when no buttons are being pressed

Open
#51 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
86
Forks
17
PR merge metrics
No merged PRs in 30d

Description

I'm testing my game with a Nintendo Switch Pro controller on Windows. The controller works perfectly fine.

I have a class that implements ControllerListener, and of course in the main class I add the listener through Controllers.addListener();.

In this function:

    @Override
    public boolean buttonDown(Controller controller, int i) {
        System.out.println("Button down: " + controller.getButton(i));

        if (i == controller.getMapping().buttonA) {
            processEnter();
        }

        return true;
    }

"Button down: true" is printed and the processEnter function gets called every frame, despite none of the buttons being pressed. I checked the buttonUp function and it acted the same way.

However, I tried downgrading the gdx-controllers version a few times, and it seems that this is a problem in 2.2.4, 2.2.3, and 2.2.2. In version 2.2.1, everything works properly and the buttonDown and buttonUp functions are called when I actually press a button, so this bug must have been introduced in 2.2.2.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a Nintendo Switch Pro controller on Windows using gdx-controllers 2.2.2 or later, then compare its button event handling with version 2.2.1. Confirm that buttonDown and buttonUp are emitted only when button state changes and that the regression no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.