Keys

:= []

Keys module - keyboard state and key constants.

Key state encoding: - 0 = Up (not pressed) - 1 = Down (currently held, pressed this frame, or released this frame, depending on which Host key-state list is passed)

The host stores fixed-size state lists with one byte per raylib key code 0-348. Named keys cover the full raylib KeyboardKey enum. Use Raw(code) through from_code when you need a backend-specific escape hatch.

from_code : U64 -> Try(KeyboardKey, [InvalidKeyCode])

Validate and wrap a raw raylib key code.

key_code : KeyboardKey -> U64

raylib key code for a key (index into the Host key-state lists).

key_down : List(U8), KeyboardKey -> Bool

Check if a specific key is currently held down. Pass host.keys.

key_up : List(U8), KeyboardKey -> Bool

Check if a specific key is currently not pressed (up). Pass host.keys.

key_pressed : List(U8), KeyboardKey -> Bool

Check if a key was first pressed this frame. Pass host.keys_pressed.

key_released : List(U8), KeyboardKey -> Bool

Check if a key was released this frame. Pass host.keys_released.

KeyboardKey

:= [
    KeyAndroidBack,
    KeyAndroidMenu,
    KeyVolumeUp,
    KeyVolumeDown,
    KeyApostrophe,
    KeyComma,
    KeyMinus,
    KeyPeriod,
    KeySlash,
    Key0,
    Key1,
    Key2,
    Key3,
    Key4,
    Key5,
    Key6,
    Key7,
    Key8,
    Key9,
    KeySemicolon,
    KeyEqual,
    KeyA,
    KeyB,
    KeyC,
    KeyD,
    KeyE,
    KeyF,
    KeyG,
    KeyH,
    KeyI,
    KeyJ,
    KeyK,
    KeyL,
    KeyM,
    KeyN,
    KeyO,
    KeyP,
    KeyQ,
    KeyR,
    KeyS,
    KeyT,
    KeyU,
    KeyV,
    KeyW,
    KeyX,
    KeyY,
    KeyZ,
    KeyLeftBracket,
    KeyBackslash,
    KeyRightBracket,
    KeyGrave,
    KeySpace,
    KeyEscape,
    KeyEnter,
    KeyTab,
    KeyBackspace,
    KeyInsert,
    KeyDelete,
    KeyRight,
    KeyLeft,
    KeyDown,
    KeyUp,
    KeyPageUp,
    KeyPageDown,
    KeyHome,
    KeyEnd,
    KeyCapsLock,
    KeyScrollLock,
    KeyNumLock,
    KeyPrintScreen,
    KeyPause,
    KeyF1,
    KeyF2,
    KeyF3,
    KeyF4,
    KeyF5,
    KeyF6,
    KeyF7,
    KeyF8,
    KeyF9,
    KeyF10,
    KeyF11,
    KeyF12,
    KeyLeftShift,
    KeyLeftControl,
    KeyLeftAlt,
    KeyLeftSuper,
    KeyRightShift,
    KeyRightControl,
    KeyRightAlt,
    KeyRightSuper,
    KeyKbMenu,
    KeyKp0,
    KeyKp1,
    KeyKp2,
    KeyKp3,
    KeyKp4,
    KeyKp5,
    KeyKp6,
    KeyKp7,
    KeyKp8,
    KeyKp9,
    KeyKpDecimal,
    KeyKpDivide,
    KeyKpMultiply,
    KeyKpSubtract,
    KeyKpAdd,
    KeyKpEnter,
    KeyKpEqual,
    Raw(U64),
]