Skip to content

Input

Keys, buttons and the mouse, from the game window’s messages, and keybinds.

rebind(chords: Array<import("salamander").Given<Wraith.Chord>>): void
unbind(): void
chords(): Array<Wraith.Chord>
next(): Promise<void>

Replaces its keys and saves them, like picking them in Settings. Empty leaves it without one.

Fails with KeybindError. Uses Chord.

Its keys stay saved for next time.

Its keys now, including the player’s picks. Good till the thread’s next call into Wraith.

Uses Chord.

Its next press, carrying on on the thread that asked. Unavailable once it’s unbound.

Async. Fails with KeybindError.

Get it with Api.input().

keyDown(key: Wraith.Key | Wraith.KeyName): boolean
buttonDown(button: Wraith.MouseButton | Wraith.MouseButtonName): boolean
mousePos(): Wraith.Point | null
bind(action: import("salamander").Given<Wraith.Input.Action>, fired: Wraith.Keybind.Fired): Wraith.Keybind
gamepad(): Wraith.Input.GamepadAxes | null

Held now. Losing focus releases everything. Any thread.

Uses Key.

Uses MouseButton.

Null if it doesn’t know yet. Any thread.

Uses Point.

A key setting listed under the plugin in Settings. Gone with the plugin.

Fails with KeybindError. Uses Input.Action, Keybind.Fired, Keybind.

Null without a controller. Any thread.

Uses Input.GamepadAxes.

Physical keys, named for the US layout. gamepad_a is the bottom face button on any controller.

An enum of u8.

Value Name
0 tab
1 left
2 right
3 up
4 down
5 page_up
6 page_down
7 home
8 end
9 insert
10 delete
11 backspace
12 space
13 enter
14 escape
15 left_ctrl
16 left_shift
17 left_alt
18 left_super
19 right_ctrl
20 right_shift
21 right_alt
22 right_super
23 menu
24 digit_0
25 digit_1
26 digit_2
27 digit_3
28 digit_4
29 digit_5
30 digit_6
31 digit_7
32 digit_8
33 digit_9
34 a
35 b
36 c
37 d
38 e
39 f
40 g
41 h
42 i
43 j
44 k
45 l
46 m
47 n
48 o
49 p
50 q
51 r
52 s
53 t
54 u
55 v
56 w
57 x
58 y
59 z
60 f1
61 f2
62 f3
63 f4
64 f5
65 f6
66 f7
67 f8
68 f9
69 f10
70 f11
71 f12
72 f13
73 f14
74 f15
75 f16
76 f17
77 f18
78 f19
79 f20
80 f21
81 f22
82 f23
83 f24
84 apostrophe
85 comma
86 minus
87 period
88 slash
89 semicolon
90 equal
91 left_bracket
92 backslash
93 right_bracket
94 grave
95 caps_lock
96 scroll_lock
97 num_lock
98 print_screen
99 pause
100 keypad_0
101 keypad_1
102 keypad_2
103 keypad_3
104 keypad_4
105 keypad_5
106 keypad_6
107 keypad_7
108 keypad_8
109 keypad_9
110 keypad_decimal
111 keypad_divide
112 keypad_multiply
113 keypad_subtract
114 keypad_add
115 keypad_enter
116 browser_back
117 browser_forward
118 oem_102
119 gamepad_a
120 gamepad_b
121 gamepad_x
122 gamepad_y
123 gamepad_left_shoulder
124 gamepad_right_shoulder
125 gamepad_left_trigger
126 gamepad_right_trigger
127 gamepad_dpad_up
128 gamepad_dpad_down
129 gamepad_dpad_left
130 gamepad_dpad_right
131 gamepad_start
132 gamepad_back
133 gamepad_left_stick
134 gamepad_right_stick

An enum of u8.

Value Name
0 left
1 right
2 middle
3 x1
4 x2

Either side.

Bits of a u8.

Bits Member Type
0 ctrl bool
1 shift bool
2 alt bool
3 super bool

A non-modifier key with exactly these modifiers. Controller buttons take none.

A struct, 0x2 bytes, aligned to 1.

Offset Field Type
0x0 key Key
0x1 mods Mods
key: Wraith.Key | Wraith.KeyName
mods: number

In the game window’s client coords.

A struct, 0x8 bytes, aligned to 4.

Offset Field Type
0x0 x i32
0x4 y i32
x: number
y: number

What can go wrong, besides Cancelled, Unsupported and Gone.

Code Error
1 Unavailable
2 AlreadyBound
3 InvalidChord
4 Failed

An enum of u8.

Value Name
0 pressed
1 released

On the render thread.

Wraith.Keybind.Fired

A struct, 0x40 bytes, aligned to 8.

Offset Field Type
0x0 id string Unique for the plugin. Letters, digits, _, - and ..
0x10 name string What Settings lists it as
0x20 chord Chord The default. The player’s picks in Settings win.
0x28 also []Chord Up to 3 more defaults, like a controller button
0x38 passthrough bool The game sees the key too
0x39 while_typing bool Still fires while typing in a text box
0x3a scope Setting.Scope Where the player’s pick is kept
0x3b held bool Held, like a move key: fires whatever modifiers are down, and can be a modifier itself. No chord modifiers.
id: string
name: string
chord: Wraith.Chord
also: Array<Wraith.Chord>
passthrough: boolean
while_typing: boolean
scope: Wraith.Setting.Scope | Wraith.Setting.ScopeName
held: boolean

Sticks -1 to 1 with up and right positive, triggers 0 to 1, no dead zone. All controllers merged.

A struct, 0x18 bytes, aligned to 4.

Offset Field Type
0x0 left_x f32
0x4 left_y f32
0x8 right_x f32
0xc right_y f32
0x10 left_trigger f32
0x14 right_trigger f32
left_x: number
left_y: number
right_x: number
right_y: number
left_trigger: number
right_trigger: number

Made with ♥ by Asgard