mcgivrer / mcgivrer/fromClassToGame

Add Joystick and Gamepad support

Open
#117 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation enhancement
Dominant language
Java
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Support for Joystick & Gamepad

To add GamePad and Joystick support, we will use the JInput java library.

To integrate the library with Maven dependency manager :

<dependency>
    <groupId>net.java.jinput</groupId>
    <artifactId>jinput</artifactId>
    <version>2.0.9</version>
</dependency>
<dependency>
    <groupId>net.java.jinput</groupId>
    <artifactId>jinput</artifactId>
    <version>2.0.9</version>
    <classifier>natives-all</classifier>
</dependency>

Need to add the build step

    <plugin>
        <groupId>com.googlecode.mavennatives</groupId>
        <artifactId>maven-nativedependencies-plugin</artifactId>
    </plugin>

And a simple usecase from the official website :

/* Create an event object for the underlying plugin to populate */
Event event = new Event();

/* Get the available controllers */
Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();
for (int i = 0; i < controllers.length; i++) {
    /* Remember to poll each one */
    controllers[i].poll();

    /* Get the controllers event queue */
    EventQueue queue = controllers[i].getEventQueue();

    /* For each object in the queue */
    while (queue.getNextEvent(event)) {
        /* Get event component */
        Component comp = event.getComponent();

        /* Process event (your awesome code) */
        ...
    }
}

And a implementation usecase : UI to test JInput entries

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

Start by inspecting the Maven build configuration and the project's current input or game-loop entry points. Read the JInput documentation and the linked UI example to understand controller polling and event handling. Done means the project includes the required JInput dependencies and native build step, with joystick and gamepad input integrated in a testable use case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.