Ketill provides dynamic device I/O for Java. Created from code originally written for the Ardenus Engine, it is intended for use in game development. However, other use cases are supported. Ketill paves an avenue to supply universal definitions for I/O devices (such as keyboards, mice, XBOX controllers, etc.) while keeping implementation details separate.
Development on Ketill began in the fall of 2021. While working on a revision of the Ardenus Engine, I decided that I wanted to create a new input system
from the ground up, since the original was clunky. At the time, Ketill was simply the input
package of the engine. Later, as the package grew in size,
I realized it could work as its own library. This would allow seamless integration with other projects.
After much refactoring, the input
package was moved to a separate repository and was reborn as a Maven project
(like its ancestor). Following additional weeks of coding, the decision was made to split the now monolothic library into modules. While Maven
supports modules, they are a nuisance to work with. However, while tinkering with FabricMC one night, I was introduced
to Gradle. The cleanliness of its build scripts was delightful, so the decision was made to use it for future projects.
By design, the definition of an IoDevice
is kept separate from the code which implements it. The implementation of a device is provided by an
IoDeviceAdapter
. Keeping the definition and implementation separate provides the following primary benefits:
- The code for defining a device is (usually) small.
- Said definitions rarely require logic, just a statement of features.
- Device definitions requires little or no unit testing when properly written.
- The same device can be implemented with different adapters, enabling features as desired.
- Cross-platform support (e.g., using
GlfwXboxAdapter
on MacOS andXInputXboxAdapter
on Windows).
Ketill also provides a litany of built-in definitions and implementations. The goal of these built-in devices and adapters is to reduce the time required to get device I/O up and running. They also serve as examples for those who wish to create their own devices and/or adapters.
The following is a list of modules included with Ketill:
Module | Description |
---|---|
api |
The base API for Ketill. |
device |
Provided definitions (Keyboard , Mouse , XboxController , etc.) |
adapter |
Provided implementations using GLFW, X-input, etc. |
If you don't want to build Ketill yourself, pre-built JARs can be found on Jenkins. However, in certain situations, building the project yourself may be necessary (e.g., if Jenkins is down.) Building Ketill is simple, and can be done following the instructions below:
- Install Git if not done so already.
- Install the JDK. Builds of the OpenJDK can be found here.
- Open a terminal of your choice and run the following commands:
git clone https://github.com/whirvis/ketill.git
cd ketill
chmod +x ./gradlew # unix only
./gradlew build
# install to local Maven repository if desired
./gradlew publishToMavenLocal
Category | Technologies |
---|---|
Development | Eclipse Adoptium, IntelliJ IDEA, and Java 8 |
Build System | Gradle and Jenkins |
Unit Testing | Equals Verifier, JetBrains Annotations, JUnit 5, and Mockito |
Quality Assurance | Codacy and Sonatype Lift |
Adapters | GLFW 3 (via LWJGL 3), JXInput, Usb4Java, and Hid4Java |
Libraries | GSON and JOML |