Package io.github.libsdl4j.api
Class Sdl
- java.lang.Object
-
- io.github.libsdl4j.api.Sdl
-
public final class Sdl extends Object
Implementation note: Native functions in this class are defined in a private static nested class and public methods from the enclosing class delegate to them.
This is for a number of reasons:
- Function signatures are not very Java idiomatic and public methods can do a basic translation (enums, pointers to Strings, etc.)
- A class with native static functions need to register itself to the JNA in its static initialization block. Execution of the block is triggered the first time any symbol is requested from the class. Including referencing a constant. That wouldn't matter too much if the very first registration also didn't trigger loading of the DLL library to memory - which can fail for various reasons. Therefore, separating the native functions to an internal class allows SDL_Init() to trigger the DLL loading explicitly and report any errors.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
SDL_Init(int flags)
static int
SDL_InitSubSystem(int flags)
static void
SDL_Quit()
static void
SDL_QuitSubSystem(int flags)
static int
SDL_WasInit(int flags)
-