Skip to content

SdlKeys

final class SdlKeys
Package: dev.joid.base.lwjgl3.sdl.input · Module: base-lwjgl3-sdl · Source: SdlKeys.java

Maps the scancodes of SDL 3 to the keys of JOID and back, by physical position or through the keyboard layout.

Its position table needs no SDL call, so a backend whose engine reports SDL scancodes reuses it; getKey reads the layout through SDL.

ReturnsSignatureSummary
intgetCode(Key key) staticReturns the SDL scancode at the physical position of the key, or SDL_SCANCODE_UNKNOWN for a key that SDL does not name.
KeygetKey(int code) staticReturns the key that the scancode types on the current keyboard layout, read with SDL_GetKeyFromScancode: on an AZERTY keyboard, the scancode of Q gives Key.A.
KeygetPhysicalKey(int code) staticReturns the key at the physical position of the scancode, whatever the layout, or Key.UNKNOWN.
booleanisKeyDown(Key key, IntPredicate down) staticIf true, the key has an SDL scancode and the predicate reports that scancode as pressed.

int getCode(Key key) static

Returns the SDL scancode at the physical position of the key, or SDL_SCANCODE_UNKNOWN for a key that SDL does not name.

Key getKey(int code) static

Returns the key that the scancode types on the current keyboard layout, read with SDL_GetKeyFromScancode: on an AZERTY keyboard, the scancode of Q gives Key.A.

Key getPhysicalKey(int code) static

Returns the key at the physical position of the scancode, whatever the layout, or Key.UNKNOWN.

boolean isKeyDown(Key key, IntPredicate down) static

If true, the key has an SDL scancode and the predicate reports that scancode as pressed.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page