-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjoystick.wu
66 lines (57 loc) · 3.36 KB
/
joystick.wu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import types { Object_T }
# GamepadAxis: enum {"leftx", "lefty", "rightx", "righty", "triggerleft", "triggerright"}
# GamepadButton: enum {"a","b","x","y","back","guide","start","leftstick","rightstick","leftshoulder","rightshoulder","dpup","dpdown","dpleft","dpright"}
# JoystickHat: enum {"c", "d", "l", "ld", "lu", "r", "rd", "ru", "u"}
# JoystickInputType: enum {"axis", "button", "hat"}
Joystick: struct {}
Joystick_T: trait {
getAxes: fun(self) -> ...float
getAxis: fun(self, int) -> float
getAxisCount: fun(self) -> int
getButtonCount: fun(self) -> int
getConnectedIndex: fun(self) -> int?
getDeviceInfo: fun(self) -> (int, int, int)
getGUID: fun(self) -> str
getGamepadAxis: fun(self, str) -> int # fun(self, GamepadAxis) -> int
getGamepadMapping: fun(self, any) -> (str, int, str?) # fun(self, GamepadAxis|GamepadButton) -> (JoystickInputType, int, JoystickHat?)
getGamepadMappingString: fun(self) -> str?
getHat: fun(self, int) -> str # fun(self, int) -> JoystickHat
getHatCount: fun(self) -> int
getID: fun(self) -> (int, int?)
getName: fun(self) -> str
getVibration: fun(self) -> (float, float)
isConnected: fun(self) -> bool
isDown: fun(self, ...int) -> bool
isGamepad: fun(self) -> bool
isGamepadDown: fun(self, ...str) -> bool # fun(self, ...GamepadButton) -> bool
isVibrationSupported: fun(self) -> bool
setVibration: fun(self, float?, float?, float?) -> bool
}
implement Joystick: Object_T {
release: extern fun(self) -> bool
type: extern fun(self) -> str
typeOf: extern fun(self, str) -> bool
}
implement Joystick: Joystick_T {
getAxes: extern fun(self) -> ...float
getAxis: extern fun(self, int) -> float
getAxisCount: extern fun(self) -> int
getButtonCount: extern fun(self) -> int
getConnectedIndex: extern fun(self) -> int?
getDeviceInfo: extern fun(self) -> (int, int, int)
getGUID: extern fun(self) -> str
getGamepadAxis: extern fun(self, str) -> int # fun(self, GamepadAxis) -> int
getGamepadMapping: extern fun(self, any) -> (str, int, str?) # fun(self, GamepadAxis|GamepadButton) -> (JoystickInputType, int, JoystickHat?)
getGamepadMappingString: extern fun(self) -> str?
getHat: extern fun(self, int) -> str # fun(self, int) -> JoystickHat
getHatCount: extern fun(self) -> int
getID: extern fun(self) -> (int, int?)
getName: extern fun(self) -> str
getVibration: extern fun(self) -> (float, float)
isConnected: extern fun(self) -> bool
isDown: extern fun(self, ...int) -> bool
isGamepad: extern fun(self) -> bool
isGamepadDown: extern fun(self, ...str) -> bool # fun(self, ...GamepadButton) -> bool
isVibrationSupported: extern fun(self) -> bool
setVibration: extern fun(self, float?, float?, float?) -> bool
}