Giter Site home page Giter Site logo

java-steam-controller's Introduction

Java Steam Controller

A Java 1.8 library which can interpret inputs from a Steam Controller.

Only the Steam Controller?

I know, most controllers rely on XInput or DInput. And I know, there are libraries for this.
However, the Steam Controller is different. The only way to receive inputs is to read raw USB data. As far as I know, common input libraries do not support this. There's no easy way to determine where each button and analog control is.
Then there's also weird behavior with the analog stick and left trackpad used together.

How to set up

You have to first setup either Maven or Gradle for your project.

For Maven:

Add the jitpack.io repository to your pom.xml file:

<repositories>
	<repository>
		<id>jitpack.io</id>
		<url>https://jitpack.io</url>
	</repository>
</repositories>

Then, add the Java-Steam-Controller dependency:

<dependencies>
	<dependency>
		<groupId>com.github.AlbinEriksson</groupId>
		<artifactId>Java-Steam-Controller</artifactId>
		<version>1.1.1</version>
	</dependency>
</dependencies>

For Gradle:

Add the jitpack.io repository to your root build.gradle file:

allprojects {
	repositories {
		maven { url "https://jitpack.io" }
	}
}

Then, add the Java-Steam-Controller dependency:

dependencies {
	compile 'com.github.AlbinEriksson:Java-Steam-Controller:1.1.1'
}

Development versions

The version number you see above is the latest release version, but you can also replace it with the short commit hash, if you want development versions.

Contributing

Well, I have one controller and one computer running on one operating system (Windows 10 x64). If any errors occur (which they probably will), hit up an issue or pull request so we can prevent it from happening.

How to use

First, you can find a Steam Controller:

List<SteamController> controllers = SteamController.getConnectedControllers();

Then, you must implement a subscriber to process inputs from the controller.

public class TestSteamControllerSubscriber implements SteamControllerSubscriber
{
    @Override
    public void update(SteamController state, SteamController last)
    {
        if(state.isAHeld() && !last.isAHeld())
            System.out.println("A button pressed!");
    }
}

And finally, to listen for inputs:

SteamControllerListener listener = new SteamControllerListener(controller);
listener.open();
TestSteamControllerSubscriber subscriber = new TestSteamControllerSubscriber();
listener.addSubscriber(subscriber);

java-steam-controller's People

Contributors

albineriksson avatar yannicklamprecht avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.