Skip to content

Base modules

A base module holds the code of one library that several backends share (Architecture and layers). Reuse one whenever your engine runs on its library: the official backends run on them, and they pass the contract suites of the testkit.

There are two kinds of base modules. An API module holds the logic of an API over a binding interface, and depends on no library:

ModuleUse it when your engineYou give it
base-openalplays sound with OpenALan IAlBinding
base-openglgives you an OpenGL 2.1 or later contextan IGlBinding and its IGlFrameBufferBindings

A library module follows the jars of one library: it binds that library to an API module, or turns its window and its input into bridges.

ModuleUse it when your engineYou write
base-lwjgl2runs on LWJGL 2: its Display, its input, its OpenGL and its OpenALnothing: create the Display, then use its bridges and give its bindings to base-opengl and base-openal
base-lwjgl3-glfwopens its window with GLFW through LWJGL 3nothing: pass the window handle
base-lwjgl3-openalplays sound with the OpenAL of LWJGL 3nothing: give its binding to base-openal
base-lwjgl3-opengldraws with the OpenGL of LWJGL 3nothing: give its binding to base-opengl
base-lwjgl3-sdlopens its window and reads its input with SDL 3 through LWJGLthe window bridge and the input forwarding, with its key table and its mouse buttons

Pick the modules of the libraries your engine already uses, and nothing else: a Vulkan engine takes no OpenGL module, an engine without sound no OpenAL module. A library module depends on the API module it binds: embed both.

Each module is published as its own jar (joid-base-<module>, which the jar task of the module builds), without its snapshot and demo packages (the hidden window and the demo window of base-lwjgl3-glfw, the snapshot capture of base-opengl), which only the dev and demo jars of the official backends carry; nor does it embed another library, such as the JNA that the cursors of base-lwjgl2 use. A module with a snapshot package also publishes it alone, as joid-base-<module>-<version>-snapshot.jar (its snapshotJar task), for a host that runs the suites of the testkit on its own context (Testing a backend). No module carries the natives of its library: the application, or the final backend, adds the natives of its platform. A backend embeds the modules it uses into its jars; in the template, put them into the embed configuration (Start from the template).

Report a problem with this page