Skip to content

Input4j 🎮 The free and pure java input library based on the Java FFM API (project 'Panama').

Notifications You must be signed in to change notification settings

gurkenlabs/input4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Input4j

Input4j is a free and pure Java input library based on the Foreign Function & Memory API (FFM API). This library doesn't have any additional native artifacts and directly interoperates with platform native libraries to access input devices.

⚠ The FFM API has been finalized with (JEP 454) with Java 22. Naturally, this library is only available for the most recent Java versions.

Required version: Java 22

🎮 Main Features

...

⚙️ Installation

...

💻 Code examples

// iterate all available input devices and poll their data every second
try (var inputDevices = InputDevices.init()) {
    while (true) {
          for (var inputDevice : inputDevices.getAll()) {

            // print all devices and polled data to the console
            System.out.println(inputDevice.getInstanceName());
            System.out.println("\t" + inputDevice.getComponents());
        }
        
        Thread.sleep(1000);
    }
}

📦 Supported input APIs

  • Windows: DirectInput ✅
  • Windows: XInput ❌
  • Linux: Linux Input (evdev) 🚧
  • OSX: IOKIT ❌
  • OSX: Game Controller ❌

About

Input4j 🎮 The free and pure java input library based on the Java FFM API (project 'Panama').

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages