gamepad

moon add Milky2018/gamepad@0.4.7
Download zip
Author
Version
0.4.7
License
Apache-2.0
Last updated
13 days ago
Downloads
6K
README

#Milky2018/gamepad

MoonBit port of core gilrs concepts (mappings, events, state, and filters), with a native-first focus.

#Status

  • Core types: Axis, Button, Event, EventType, GamepadState
  • SDL mapping parser + mapping utilities
  • Filters: jitter, deadzone, axis_dpad_to_button, Repeat
  • Mockable core: Gilrs::new_mock, GilrsBuilder (mock), Gamepad handle
  • Blocking event wait: Gilrs::next_event_blocking(timeout_ms)

#Platform Support (Checklist)

This project is macOS-first. Linux/Windows are tracked as follow-ups and may have behavioral gaps.

  • macOS (native / IOHIDManager)
  • Linux (native / evdev) (planned to harden later)
  • Windows (native / XInput) (planned to harden later)

#Notes / Limitations (vs upstream gilrs)

  • Code is backend-specific. On macOS it matches gilrs-core's HID EvCode encoding: (usage_page << 16) | usage.
  • On macOS, some HID axes (e.g. GenericDesktop Rx/Ry) are intentionally left unmapped to Axis by default (matching gilrs-core's "unconfirmed" constants). Use the SDL mapping DB to get semantic axis/button names for these codes.
  • On macOS, PowerInfo is intentionally Unknown (parity with upstream gilrs-core).
  • Force-feedback repeat mode is exposed as FfRepeat to avoid naming collision with event filter Repeat.

#Quickstart (native)

let gilrs = Gilrs::new()

while true {
match gilrs.next_event() {
None => break
Some(ev) => println(ev)
}
}

#Quickstart (mock)

let gilrs =
GilrsBuilder::new()
.with_mock_gamepad_count(1)
.with_default_filters(true)
.build()

let id = GamepadId::new(0)
gilrs.insert_event(Event::at(id, EventType::ButtonPressed(Button::South, BTN_SOUTH), 0L))

match gilrs.next_event() {
None => ()
Some(ev) => println(ev.id().value())
}

#
Code

type Code = Int

#
DistanceModelError

type DistanceModelError

#
FfError

type FfError

#
GilrsError

type GilrsError

#
MappingError

type MappingError

#
ParseSdlMappingError

type ParseSdlMappingError

#
ParserError

type ParserError

#
ParserError::kind

#
ParserError::position

fn ParserError::position(self : ParserError) -> Int

#
UuidError

type UuidError

#
Axis

pub(all) enum Axis {
LeftStickX
LeftStickY
LeftZ
RightStickX
RightStickY
RightZ
DPadX
DPadY
Unknown
}

#
Axis::is_stick

fn Axis::is_stick(self : Axis) -> Bool

#
Axis::second_axis

fn Axis::second_axis(self : Axis) -> Axis?

#
Axis::to_index

fn Axis::to_index(self : Axis) -> Int

#
AxisData

pub struct AxisData {
last_event_ts : Int64
last_event_c : Int64
value : Double
}

#
AxisData::counter

fn AxisData::counter(self : AxisData) -> Int64

#
AxisData::timestamp

fn AxisData::timestamp(self : AxisData) -> Int64

#
AxisData::value

fn AxisData::value(self : AxisData) -> Double

#
AxisInfo

pub struct AxisInfo {
min : Int
max : Int
deadzone : Int?
}

#
AxisInfo::new

fn AxisInfo::new(min : Int, max : Int, deadzone : Int?) -> AxisInfo

#
AxisOrBtn

pub(all) enum AxisOrBtn {
Axis(Axis)
Btn(Button)
}

#
AxisOrBtn::is_button

fn AxisOrBtn::is_button(self : AxisOrBtn) -> Bool

#
AxisRange

pub(all) enum AxisRange {
LowerHalf
UpperHalf
Full
}

#
BackendOwner

type BackendOwner

#
BaseEffect

pub struct BaseEffect {
kind : BaseEffectType
scheduling : Replay
envelope : Envelope
}

#
BaseEffect::default

fn BaseEffect::default() -> BaseEffect

#
BaseEffectType

pub(all) enum BaseEffectType {
Weak(Int)
Strong(Int)
}

#
Button

pub(all) enum Button {
South
East
C
North
West
Z
LeftTrigger
RightTrigger
LeftTrigger2
RightTrigger2
Select
Start
Mode
LeftThumb
RightThumb
DPadUp
DPadDown
DPadLeft
DPadRight
Unknown
}

#
Button::is_action

fn Button::is_action(self : Button) -> Bool

#
Button::is_dpad

fn Button::is_dpad(self : Button) -> Bool

#
Button::is_menu

fn Button::is_menu(self : Button) -> Bool

#
Button::is_stick

fn Button::is_stick(self : Button) -> Bool

#
Button::is_trigger

fn Button::is_trigger(self : Button) -> Bool

#
Button::to_index

fn Button::to_index(self : Button) -> Int

#
ButtonData

pub struct ButtonData {
last_event_ts : Int64
counter : Int64
value : Double
is_pressed : Bool
is_repeating : Bool
}

#
ButtonData::counter

fn ButtonData::counter(self : ButtonData) -> Int64

#
ButtonData::is_pressed

fn ButtonData::is_pressed(self : ButtonData) -> Bool

#
ButtonData::is_repeating

fn ButtonData::is_repeating(self : ButtonData) -> Bool

#
ButtonData::timestamp

fn ButtonData::timestamp(self : ButtonData) -> Int64

#
ButtonData::value

fn ButtonData::value(self : ButtonData) -> Double

#
DistanceModel

pub enum DistanceModel {
None
Linear(Double, Double, Double)
LinearClamped(Double, Double, Double)
Inverse(Double, Double)
InverseClamped(Double, Double, Double)
Exponential(Double, Double)
ExponentialClamped(Double, Double, Double)
}

#
DistanceModel::validate

fn DistanceModel::validate(self : DistanceModel) -> Unit raise DistanceModelError

#
Effect

pub struct Effect {
gilrs : Gilrs
gamepads : Array[GamepadId]
strong : Double
weak : Double
duration_ms : Int64
base_effects : Array[BaseEffect]
repeat_mode : FfRepeat
distance_model : DistanceModel
position : (Double, Double, Double)
gain : Double
}

#
Effect::add_gamepad

fn Effect::add_gamepad(self : Effect, gamepad : Gamepad) -> Unit raise FfError

#
Effect::play

fn Effect::play(self : Effect) -> Unit raise FfError

#
Effect::set_distance_model

fn Effect::set_distance_model(self : Effect, model : DistanceModel) -> Unit raise FfError

#
Effect::set_gain

fn Effect::set_gain(self : Effect, gain : Double) -> Unit

#
Effect::set_gamepads

fn Effect::set_gamepads(self : Effect, ids : Array[GamepadId], gilrs : Gilrs) -> Unit raise FfError

#
Effect::set_position

fn Effect::set_position(self : Effect, position : (Double, Double, Double)) -> Unit

#
Effect::set_repeat

fn Effect::set_repeat(self : Effect, repeat_mode : FfRepeat) -> Unit

#
Effect::stop

fn Effect::stop(self : Effect) -> Unit raise FfError

#
EffectBuilder

pub struct EffectBuilder {
gamepads : Array[GamepadId]
base_effects : Array[BaseEffect]
repeat_mode : FfRepeat
distance_model : DistanceModel
position : (Double, Double, Double)
gain : Double
strong : Double
weak : Double
duration_ms : Int64
}

#
EffectBuilder::add_effect

fn EffectBuilder::add_effect(self : EffectBuilder, effect : BaseEffect) -> EffectBuilder

#
EffectBuilder::add_gamepad

fn EffectBuilder::add_gamepad(self : EffectBuilder, gamepad : Gamepad) -> EffectBuilder

#
EffectBuilder::add_gamepad_id

fn EffectBuilder::add_gamepad_id(self : EffectBuilder, id : GamepadId) -> EffectBuilder

#
EffectBuilder::distance_model

fn EffectBuilder::distance_model(self : EffectBuilder, model : DistanceModel) -> EffectBuilder

#
EffectBuilder::duration

fn EffectBuilder::duration(self : EffectBuilder, duration_ms : Int64) -> EffectBuilder

#
EffectBuilder::finish

fn EffectBuilder::finish(self : EffectBuilder, gilrs : Gilrs) -> Effect raise FfError

#
EffectBuilder::gain

fn EffectBuilder::gain(self : EffectBuilder, gain : Double) -> EffectBuilder

#
EffectBuilder::gamepads

fn EffectBuilder::gamepads(self : EffectBuilder, ids : Array[GamepadId]) -> EffectBuilder

#
EffectBuilder::new

#
EffectBuilder::position

fn EffectBuilder::position(self : EffectBuilder, position : (Double, Double, Double)) -> EffectBuilder

#
EffectBuilder::repeat

fn EffectBuilder::repeat(self : EffectBuilder, repeat_mode : FfRepeat) -> EffectBuilder

#
EffectBuilder::rumble

fn EffectBuilder::rumble(self : EffectBuilder, strong : Double, weak : Double) -> EffectBuilder

#
Envelope

pub struct Envelope {
attack_length : Int
attack_level : Double
fade_length : Int
fade_level : Double
}

#
Envelope::at

fn Envelope::at(self : Envelope, ticks : Int, dur : Int) -> Double

#
Envelope::default

fn Envelope::default() -> Envelope

#
Event

pub struct Event {
id : GamepadId
event : EventType
time : Int64
}

#
Event::at

fn Event::at(id : GamepadId, event : EventType, time : Int64) -> Event

#
Event::drop

fn Event::drop(self : Event) -> Event

#
Event::event

fn Event::event(self : Event) -> EventType

#
Event::id

fn Event::id(self : Event) -> GamepadId

#
Event::is_dropped

fn Event::is_dropped(self : Event) -> Bool

#
Event::new

fn Event::new(id : GamepadId, event : EventType) -> Event

#
Event::time

fn Event::time(self : Event) -> Int64

#
EventType

pub(all) enum EventType {
ButtonPressed(Button, Int)
ButtonRepeated(Button, Int)
ButtonReleased(Button, Int)
ButtonChanged(Button, Double, Int)
AxisChanged(Axis, Double, Int)
Connected
Disconnected
Dropped
ForceFeedbackEffectCompleted
}

#
FfRepeat

pub enum FfRepeat {
Infinitely
For(Int64)
}

#
Gamepad

pub struct Gamepad {
gilrs : Gilrs
id : GamepadId
}

#
Gamepad::axes

fn Gamepad::axes(self : Gamepad) -> Array[Int]

#
Gamepad::axis_code

fn Gamepad::axis_code(self : Gamepad, axis : Axis) -> Int?

#
Gamepad::axis_data

fn Gamepad::axis_data(self : Gamepad, axis : Axis) -> AxisData?

#
Gamepad::axis_info

fn Gamepad::axis_info(self : Gamepad, code : Int) -> AxisInfo?

#
Gamepad::axis_or_btn_name

fn Gamepad::axis_or_btn_name(self : Gamepad, code : Int) -> AxisOrBtn?

#
Gamepad::button_code

fn Gamepad::button_code(self : Gamepad, btn : Button) -> Int?

#
Gamepad::button_data

fn Gamepad::button_data(self : Gamepad, btn : Button) -> ButtonData?

#
Gamepad::buttons

fn Gamepad::buttons(self : Gamepad) -> Array[Int]

#
Gamepad::deadzone

fn Gamepad::deadzone(self : Gamepad, code : Int) -> Double?

#
Gamepad::id

fn Gamepad::id(self : Gamepad) -> GamepadId

#
Gamepad::is_connected

fn Gamepad::is_connected(self : Gamepad) -> Bool

#
Gamepad::is_ff_supported

fn Gamepad::is_ff_supported(self : Gamepad) -> Bool

#
Gamepad::is_pressed

fn Gamepad::is_pressed(self : Gamepad, btn : Button) -> Bool

#
Gamepad::map_name

fn Gamepad::map_name(self : Gamepad) -> String?

#
Gamepad::mapping

fn Gamepad::mapping(self : Gamepad) -> Mapping?

#
Gamepad::mapping_source

fn Gamepad::mapping_source(self : Gamepad) -> MappingSource

#
Gamepad::name

fn Gamepad::name(self : Gamepad) -> String

#
Gamepad::os_name

fn Gamepad::os_name(self : Gamepad) -> String

#
Gamepad::power_info

fn Gamepad::power_info(self : Gamepad) -> PowerInfo

#
Gamepad::product_id

fn Gamepad::product_id(self : Gamepad) -> Int?

#
Gamepad::set_listener_position

fn Gamepad::set_listener_position(self : Gamepad, position : (Double, Double, Double)) -> Unit raise FfError

#
Gamepad::state

fn Gamepad::state(self : Gamepad) -> GamepadState

#
Gamepad::uuid

fn Gamepad::uuid(self : Gamepad) -> Uuid

#
Gamepad::value

fn Gamepad::value(self : Gamepad, axis : Axis) -> Double

#
Gamepad::vendor_id

fn Gamepad::vendor_id(self : Gamepad) -> Int?

#
GamepadData

pub struct GamepadData {
state : GamepadState
connected : Bool
mapping : Mapping
name : String
uuid : Uuid
vendor_id : Int?
product_id : Int?
ff_supported : Bool
power_info : PowerInfo
axes : Array[Int]
buttons : Array[Int]
axis_info : Array[(Int, AxisInfo)]
deadzones : Array[(Int, Double)]
have_sent_nonzero_for_axis : Array[Bool]
}

#
GamepadId

pub struct GamepadId {
value : Int
}

#
GamepadId::new

fn GamepadId::new(value : Int) -> GamepadId

#
GamepadId::value

fn GamepadId::value(self : GamepadId) -> Int

#
GamepadState

pub struct GamepadState {
buttons : Array[(Int, ButtonData)]
axes : Array[(Int, AxisData)]
}

#
GamepadState::axes_entries

fn GamepadState::axes_entries(self : GamepadState) -> Array[(Int, AxisData)]

#
GamepadState::axis_data

fn GamepadState::axis_data(self : GamepadState, axis : Int) -> AxisData?

#
GamepadState::button_data

fn GamepadState::button_data(self : GamepadState, btn : Int) -> ButtonData?

#
GamepadState::buttons_entries

fn GamepadState::buttons_entries(self : GamepadState) -> Array[(Int, ButtonData)]

#
GamepadState::is_pressed

fn GamepadState::is_pressed(self : GamepadState, btn : Int) -> Bool

#
GamepadState::new

#
GamepadState::value

fn GamepadState::value(self : GamepadState, el : Int) -> Double

#
Gilrs

pub struct Gilrs {
counter : Int64
update_state : Bool
default_filters : Bool
axis_to_btn_pressed : Double
axis_to_btn_released : Double
events : Array[Event]
events_head : Int
gamepads_data : Array[GamepadData]
mappings : MappingDb
now_ms : Int64
backend : NativeBackend?
}

#
Gilrs::axis_code

fn Gilrs::axis_code(self : Gilrs, id : GamepadId, axis : Axis) -> Int?

#
Gilrs::axis_or_btn_name

fn Gilrs::axis_or_btn_name(self : Gilrs, id : GamepadId, code : Int) -> AxisOrBtn?

#
Gilrs::button_code

fn Gilrs::button_code(self : Gilrs, id : GamepadId, btn : Button) -> Int?

#
Gilrs::connected_gamepad

fn Gilrs::connected_gamepad(self : Gilrs, id : GamepadId) -> Gamepad?

#
Gilrs::counter

fn Gilrs::counter(self : Gilrs) -> Int64

#
Gilrs::deadzone

fn Gilrs::deadzone(self : Gilrs, id : GamepadId, code : Int) -> Double?

#
Gilrs::default_filters_enabled

fn Gilrs::default_filters_enabled(self : Gilrs) -> Bool

#
Gilrs::gamepad

fn Gilrs::gamepad(self : Gilrs, id : GamepadId) -> Gamepad?

#
Gilrs::gamepads

fn Gilrs::gamepads(self : Gilrs) -> Array[(GamepadId, Gamepad)]

#
Gilrs::inc

fn Gilrs::inc(self : Gilrs) -> Unit

#
Gilrs::insert_event

fn Gilrs::insert_event(self : Gilrs, ev : Event) -> Unit

#
Gilrs::is_connected

fn Gilrs::is_connected(self : Gilrs, id : GamepadId) -> Bool

#
Gilrs::load_mappings

fn Gilrs::load_mappings(self : Gilrs, s : String) -> Unit

#
Gilrs::mapping

fn Gilrs::mapping(self : Gilrs, id : GamepadId) -> Mapping?

#
Gilrs::new

fn Gilrs::new() -> Gilrs

#
Gilrs::new_mock

fn Gilrs::new_mock(gamepad_count : Int, update_state? : Bool, default_filters? : Bool) -> Gilrs

#
Gilrs::new_native

fn Gilrs::new_native(update_state? : Bool, default_filters? : Bool) -> Gilrs

#
Gilrs::next_event

fn Gilrs::next_event(self : Gilrs) -> Event?

#
Gilrs::next_event_blocking

fn Gilrs::next_event_blocking(self : Gilrs, timeout_ms : Int64?) -> Event?

#
Gilrs::poll

fn Gilrs::poll(self : Gilrs) -> Unit

#
Gilrs::reset_counter

fn Gilrs::reset_counter(self : Gilrs) -> Unit

#
Gilrs::set_axis_to_btn

fn Gilrs::set_axis_to_btn(self : Gilrs, pressed : Double, released : Double) -> Unit raise GilrsError

#
Gilrs::set_deadzone

fn Gilrs::set_deadzone(self : Gilrs, id : GamepadId, code : Int, threshold : Double) -> Unit

#
Gilrs::set_mapping

fn Gilrs::set_mapping(self : Gilrs, id : GamepadId, mapping : Mapping) -> Unit

#
Gilrs::set_mapping_data

fn Gilrs::set_mapping_data(self : Gilrs, id : GamepadId, mapping_data : MappingData, name? : String?) -> String raise MappingError

#
Gilrs::set_mapping_data_strict

fn Gilrs::set_mapping_data_strict(self : Gilrs, id : GamepadId, mapping_data : MappingData, name? : String?) -> String raise MappingError

#
Gilrs::set_time

fn Gilrs::set_time(self : Gilrs, now_ms : Int64) -> Unit

#
Gilrs::state

fn Gilrs::state(self : Gilrs, id : GamepadId) -> GamepadState?

#
Gilrs::time

fn Gilrs::time(self : Gilrs) -> Int64

#
Gilrs::update

fn Gilrs::update(self : Gilrs, event : Event) -> Unit

#
Gilrs::update_state_enabled

fn Gilrs::update_state_enabled(self : Gilrs) -> Bool

#
Gilrs::with_default_filters

fn Gilrs::with_default_filters(self : Gilrs, enabled : Bool) -> Gilrs

#
GilrsBuilder

pub struct GilrsBuilder {
update_state : Bool
default_filters : Bool
axis_to_btn_pressed : Double
axis_to_btn_released : Double
env_mappings : Bool
included_mappings : Bool
mock_gamepad_count : Int
use_native_backend : Bool
mapping_inputs : Array[String]
}

#
GilrsBuilder::add_env_mappings

fn GilrsBuilder::add_env_mappings(self : GilrsBuilder, env_mappings : Bool) -> GilrsBuilder

#
GilrsBuilder::add_included_mappings

fn GilrsBuilder::add_included_mappings(self : GilrsBuilder, included_mappings : Bool) -> GilrsBuilder

#
GilrsBuilder::add_mappings

fn GilrsBuilder::add_mappings(self : GilrsBuilder, mappings : String) -> GilrsBuilder

#
GilrsBuilder::build

fn GilrsBuilder::build(self : GilrsBuilder) -> Gilrs

#
GilrsBuilder::new

#
GilrsBuilder::set_axis_to_btn

fn GilrsBuilder::set_axis_to_btn(self : GilrsBuilder, pressed : Double, released : Double) -> GilrsBuilder

#
GilrsBuilder::set_update_state

fn GilrsBuilder::set_update_state(self : GilrsBuilder, v : Bool) -> GilrsBuilder

#
GilrsBuilder::with_default_filters

fn GilrsBuilder::with_default_filters(self : GilrsBuilder, v : Bool) -> GilrsBuilder

#
GilrsBuilder::with_mock_gamepad_count

fn GilrsBuilder::with_mock_gamepad_count(self : GilrsBuilder, n : Int) -> GilrsBuilder

#
GilrsBuilder::with_native_backend

fn GilrsBuilder::with_native_backend(self : GilrsBuilder, v : Bool) -> GilrsBuilder

#
Jitter

pub struct Jitter {
threshold : Double
}

#
Jitter::filter

fn Jitter::filter(self : Jitter, ev : Event?, gilrs : Gilrs) -> Event?

#
Jitter::new

fn Jitter::new() -> Jitter

#
Mapping

pub struct Mapping {
mappings : Array[(Int, AxisOrBtn)]
name : String
default : Bool
hats_mapped : Int
}

#
Mapping::entries

fn Mapping::entries(self : Mapping) -> Array[(Int, AxisOrBtn)]

#
Mapping::from_data

fn Mapping::from_data(data : MappingData, buttons : Array[Int], axes : Array[Int], name : String, uuid : Uuid) -> (Mapping, String) raise MappingError

#
Mapping::hats_mapped

fn Mapping::hats_mapped(self : Mapping) -> Int

#
Mapping::insert

fn Mapping::insert(self : Mapping, code : Int, el : AxisOrBtn) -> Unit

#
Mapping::is_default

fn Mapping::is_default(self : Mapping) -> Bool

#
Mapping::map

fn Mapping::map(self : Mapping, code : Int) -> AxisOrBtn?

#
Mapping::map_rev

fn Mapping::map_rev(self : Mapping, el : AxisOrBtn) -> Int?

#
Mapping::name

fn Mapping::name(self : Mapping) -> String

#
Mapping::new

fn Mapping::new() -> Mapping

#
Mapping::new_default

fn Mapping::new_default() -> Mapping

#
Mapping::parse_sdl_mapping

fn Mapping::parse_sdl_mapping(line : String, buttons : Array[Int], axes : Array[Int]) -> Mapping raise ParseSdlMappingError

#
Mapping::set_hats_mapped

fn Mapping::set_hats_mapped(self : Mapping, hats : Int) -> Unit

#
MappingData

pub struct MappingData {
buttons : Array[Int?]
axes : Array[Int?]
}

#
MappingData::axis

fn MappingData::axis(self : MappingData, idx : Axis) -> Int?

#
MappingData::button

fn MappingData::button(self : MappingData, idx : Button) -> Int?

#
MappingData::insert_axis

fn MappingData::insert_axis(self : MappingData, from : Int, to : Axis) -> Int?

#
MappingData::insert_btn

fn MappingData::insert_btn(self : MappingData, from : Int, to : Button) -> Int?

#
MappingData::new

#
MappingData::remove_axis

fn MappingData::remove_axis(self : MappingData, idx : Axis) -> Int?

#
MappingData::remove_button

fn MappingData::remove_button(self : MappingData, idx : Button) -> Int?

#
MappingDb

pub struct MappingDb {
mappings : Array[(Uuid, String)]
}

#
MappingDb::add_env_mappings

fn MappingDb::add_env_mappings(self : MappingDb) -> Unit

#
MappingDb::add_included_mappings

fn MappingDb::add_included_mappings(self : MappingDb) -> Unit

#
MappingDb::get

fn MappingDb::get(self : MappingDb, uuid : Uuid) -> String?

#
MappingDb::insert

fn MappingDb::insert(self : MappingDb, s : String) -> Unit

#
MappingDb::len

fn MappingDb::len(self : MappingDb) -> Int

#
MappingDb::new

fn MappingDb::new() -> MappingDb

#
MappingSource

pub enum MappingSource {
SdlMappings
Driver
None
}

#
NativeBackend

pub struct NativeBackend {
owner : BackendOwner
}

#
NativeBackend::axes

fn NativeBackend::axes(self : NativeBackend, id : Int) -> Array[Int]

#
NativeBackend::axis_info

fn NativeBackend::axis_info(self : NativeBackend, id : Int, code : Int) -> AxisInfo?

#
NativeBackend::buttons

fn NativeBackend::buttons(self : NativeBackend, id : Int) -> Array[Int]

#
NativeBackend::gamepad_count

fn NativeBackend::gamepad_count(self : NativeBackend) -> Int

#
NativeBackend::is_ff_supported

fn NativeBackend::is_ff_supported(self : NativeBackend, id : Int) -> Bool

#
NativeBackend::name

fn NativeBackend::name(self : NativeBackend, id : Int) -> String

#
NativeBackend::new

#
NativeBackend::next_event

fn NativeBackend::next_event(self : NativeBackend) -> NativeEvent?

#
NativeBackend::poll

fn NativeBackend::poll(self : NativeBackend) -> Unit

#
NativeBackend::poll_timeout

fn NativeBackend::poll_timeout(self : NativeBackend, timeout_ms : Int) -> Unit

#
NativeBackend::product_id

fn NativeBackend::product_id(self : NativeBackend, id : Int) -> Int?

#
NativeBackend::set_rumble

fn NativeBackend::set_rumble(self : NativeBackend, id : Int, strong : Double, weak : Double, duration_ms : Int) -> Bool

#
NativeBackend::uuid_simple

fn NativeBackend::uuid_simple(self : NativeBackend, id : Int) -> String

#
NativeBackend::vendor_id

fn NativeBackend::vendor_id(self : NativeBackend, id : Int) -> Int?

#
NativeEvent

pub struct NativeEvent {
tag : NativeEventTag
id : Int
code : Int
value : Double
time_ms : Int64
}

#
NativeEventTag

pub(all) enum NativeEventTag {
Connected
Disconnected
ButtonPressed
ButtonReleased
AxisChanged
ButtonChanged
}

#
ParserErrorKind

pub(all) enum ParserErrorKind {
InvalidGuid
InvalidKeyValPair
InvalidValue
EmptyValue
UnknownAxis
UnknownButton
InvalidParserState
UnexpectedEnd
}

#
PowerInfo

pub enum PowerInfo {
Unknown
Wired
Discharging(Int)
Charging(Int)
Charged
}

#
Repeat

pub struct Repeat {
after_ms : Int64
every_ms : Int64
}

#
Repeat::filter

fn Repeat::filter(self : Repeat, ev : Event?, gilrs : Gilrs) -> Event?

#
Repeat::new

fn Repeat::new() -> Repeat

#
Replay

pub struct Replay {
after : Int
play_for : Int
with_delay : Int
}

#
Replay::at

fn Replay::at(self : Replay, ticks : Int) -> Double

#
Replay::default

fn Replay::default() -> Replay

#
Ticks

pub struct Ticks {
ms : Int64
}

#
Ticks::as_ms

fn Ticks::as_ms(self : Ticks) -> Int64

#
Ticks::from_ms

fn Ticks::from_ms(ms : Int64) -> Ticks

#
Token

pub(all) enum Token {
Uuid(Uuid)
Platform(String)
Name(String)
AxisMapping(Int, AxisOrBtn, AxisRange, AxisRange, Bool)
ButtonMapping(Int, AxisOrBtn, AxisRange)
HatMapping(Int, Int, AxisOrBtn, AxisRange)
}

#
Uuid

pub struct Uuid {
simple : String
}

#
Uuid::nil

fn Uuid::nil() -> Uuid

#
Uuid::parse

fn Uuid::parse(s : String) -> Uuid raise UuidError

#
Uuid::simple

fn Uuid::simple(self : Uuid) -> String

#
AXIS_COUNT

let AXIS_COUNT : Int

#
AXIS_DPADX

let AXIS_DPADX : Int

#
AXIS_DPADY

let AXIS_DPADY : Int

#
AXIS_LEFTZ

let AXIS_LEFTZ : Int

#
AXIS_LSTICKX

let AXIS_LSTICKX : Int

#
AXIS_LSTICKY

let AXIS_LSTICKY : Int

#
AXIS_LT

let AXIS_LT : Int

#
AXIS_LT2

let AXIS_LT2 : Int

#
AXIS_RIGHTZ

let AXIS_RIGHTZ : Int

#
AXIS_RSTICKX

let AXIS_RSTICKX : Int

#
AXIS_RSTICKY

let AXIS_RSTICKY : Int

#
AXIS_RT

let AXIS_RT : Int

#
AXIS_RT2

let AXIS_RT2 : Int

#
BTN_C

let BTN_C : Int

#
BTN_DPAD_DOWN

let BTN_DPAD_DOWN : Int

#
BTN_DPAD_LEFT

let BTN_DPAD_LEFT : Int

#
BTN_DPAD_RIGHT

let BTN_DPAD_RIGHT : Int

#
BTN_DPAD_UP

let BTN_DPAD_UP : Int

#
BTN_EAST

let BTN_EAST : Int

#
BTN_LT

let BTN_LT : Int

#
BTN_LT2

let BTN_LT2 : Int

#
BTN_LTHUMB

let BTN_LTHUMB : Int

#
BTN_MODE

let BTN_MODE : Int

#
BTN_NORTH

let BTN_NORTH : Int

#
BTN_RT

let BTN_RT : Int

#
BTN_RT2

let BTN_RT2 : Int

#
BTN_RTHUMB

let BTN_RTHUMB : Int

#
BTN_SELECT

let BTN_SELECT : Int

#
BTN_SOUTH

let BTN_SOUTH : Int

#
BTN_START

let BTN_START : Int

#
BTN_WEST

let BTN_WEST : Int

#
BTN_Z

let BTN_Z : Int

#
BUTTON_COUNT

let BUTTON_COUNT : Int

#
LEGACY_AXIS_DPADX

let LEGACY_AXIS_DPADX : Int

#
LEGACY_AXIS_DPADY

let LEGACY_AXIS_DPADY : Int

#
LEGACY_AXIS_LEFTZ

let LEGACY_AXIS_LEFTZ : Int

#
LEGACY_AXIS_LSTICKX

let LEGACY_AXIS_LSTICKX : Int

#
LEGACY_AXIS_LSTICKY

let LEGACY_AXIS_LSTICKY : Int

#
LEGACY_AXIS_LT

let LEGACY_AXIS_LT : Int

#
LEGACY_AXIS_LT2

let LEGACY_AXIS_LT2 : Int

#
LEGACY_AXIS_RIGHTZ

let LEGACY_AXIS_RIGHTZ : Int

#
LEGACY_AXIS_RSTICKX

let LEGACY_AXIS_RSTICKX : Int

#
LEGACY_AXIS_RSTICKY

let LEGACY_AXIS_RSTICKY : Int

#
LEGACY_AXIS_RT

let LEGACY_AXIS_RT : Int

#
LEGACY_AXIS_RT2

let LEGACY_AXIS_RT2 : Int

#
LEGACY_BTN_C

let LEGACY_BTN_C : Int

#
LEGACY_BTN_DPAD_DOWN

let LEGACY_BTN_DPAD_DOWN : Int

#
LEGACY_BTN_DPAD_LEFT

let LEGACY_BTN_DPAD_LEFT : Int

#
LEGACY_BTN_DPAD_RIGHT

let LEGACY_BTN_DPAD_RIGHT : Int

#
LEGACY_BTN_DPAD_UP

let LEGACY_BTN_DPAD_UP : Int

#
LEGACY_BTN_EAST

let LEGACY_BTN_EAST : Int

#
LEGACY_BTN_LT

let LEGACY_BTN_LT : Int

#
LEGACY_BTN_LT2

let LEGACY_BTN_LT2 : Int

#
LEGACY_BTN_LTHUMB

let LEGACY_BTN_LTHUMB : Int

#
LEGACY_BTN_MODE

let LEGACY_BTN_MODE : Int

#
LEGACY_BTN_NORTH

let LEGACY_BTN_NORTH : Int

#
LEGACY_BTN_RT

let LEGACY_BTN_RT : Int

#
LEGACY_BTN_RT2

let LEGACY_BTN_RT2 : Int

#
LEGACY_BTN_RTHUMB

let LEGACY_BTN_RTHUMB : Int

#
LEGACY_BTN_SELECT

let LEGACY_BTN_SELECT : Int

#
LEGACY_BTN_SOUTH

let LEGACY_BTN_SOUTH : Int

#
LEGACY_BTN_START

let LEGACY_BTN_START : Int

#
LEGACY_BTN_WEST

let LEGACY_BTN_WEST : Int

#
LEGACY_BTN_Z

let LEGACY_BTN_Z : Int

#
PAGE_BUTTON

let PAGE_BUTTON : Int

#
PAGE_GENERIC_DESKTOP

let PAGE_GENERIC_DESKTOP : Int

#
PAGE_SIMULATION

let PAGE_SIMULATION : Int

#
axis_dpad_to_button

fn axis_dpad_to_button(ev : Event?, gilrs : Gilrs) -> Event?

#
axis_from_code

fn axis_from_code(code : Int) -> Axis?

#
axis_or_btn_from_code

fn axis_or_btn_from_code(code : Int) -> AxisOrBtn?

#
axis_value

fn axis_value(info : AxisInfo, val : Int, axis : Axis) -> Double

#
btn_value

fn btn_value(info : AxisInfo, val : Int) -> Double

#
button_from_code

fn button_from_code(code : Int) -> Button?

#
ceil_div

fn ceil_div(a : UInt, b : UInt) -> UInt

#
clamp

fn clamp(x : Double, min : Double, max : Double) -> Double

#
deadzone

fn deadzone(ev : Event?, gilrs : Gilrs) -> Event?

#
decode_native_event

fn decode_native_event(b : Bytes) -> NativeEvent?

#
default_axis_code

fn default_axis_code(axis : Axis) -> Int?

#
default_button_code

fn default_button_code(btn : Button) -> Int?

#
filter_ev

fn filter_ev(ev : Event?, filter : (Event?, Gilrs) -> Event?, gilrs : Gilrs) -> Event?

#
hid_code

fn hid_code(page : Int, usage : Int) -> Int

#
hid_page

fn hid_page(code : Int) -> Int

#
hid_usage

fn hid_usage(code : Int) -> Int

#
jitter

fn jitter(ev : Event?, gilrs : Gilrs, threshold : Double) -> Event?

#
runtime_env_sdl_gamecontrollerconfig

fn runtime_env_sdl_gamecontrollerconfig() -> String

#
runtime_now_ms

fn runtime_now_ms() -> Int64

#
runtime_sdl_platform_name

fn runtime_sdl_platform_name() -> String