-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
- First download the latest release from this page
- Now you have to put the JAR files in your project's module path
- Make your
module-info.java
requirede.ralleytn.simple.input
- Done!
This library only supports mice, keyboards and gamepads/joysticks at the moment.
Gamepads and joysticks will be treated as one and the same through the Gamepad
class to make things easier.
Any other device will be inaccessible when using this library.
The main class of this library is the DeviceManager
.
Before you can use the library you have to call its create
method.
And when you are done using it, call its destroy
method.
A device is not listening from the get go.
You have to call the startListening
method for every device that you want to listen to.
To stop listening you call the stopListening
method.
DeviceManager.destroy
will call stopListening
for every device.
Every device uses its own daemon thread to listen to input events.
For every type of device there is a class that extends Device
and represents the device itself,
An interface that extends DevieListener
to provide the methods that will be fired when input events occur,
An adapter class that implements the listener class and leaves the method bodies empty, a class
that extends DeviceEvent
and methods in the DeviceManager
to retrieve all devices of that type and to
add and remove listeners to/from all devices of that type.