-
Notifications
You must be signed in to change notification settings - Fork 4
/
button_string.go
69 lines (63 loc) · 1.77 KB
/
button_string.go
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
67
68
69
// Code generated by "stringer -type=Button"; DO NOT EDIT.
package ps4
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[DPadX-16]
_ = x[DPadY-17]
_ = x[LeftStickX-0]
_ = x[LeftStickY-1]
_ = x[LeftStickClick-317]
_ = x[RightStickX-3]
_ = x[RightStickY-4]
_ = x[RightStickClick-318]
_ = x[L1-310]
_ = x[L2Click-312]
_ = x[L2-2]
_ = x[R1-311]
_ = x[R2Click-313]
_ = x[R2-5]
_ = x[Share-314]
_ = x[Options-315]
_ = x[Playstation-316]
_ = x[Triangle-307]
_ = x[Circle-305]
_ = x[X-304]
_ = x[Square-308]
}
const (
_Button_name_0 = "LeftStickXLeftStickYL2RightStickXRightStickYR2"
_Button_name_1 = "DPadXDPadY"
_Button_name_2 = "XCircle"
_Button_name_3 = "TriangleSquare"
_Button_name_4 = "L1R1L2ClickR2ClickShareOptionsPlaystationLeftStickClickRightStickClick"
)
var (
_Button_index_0 = [...]uint8{0, 10, 20, 22, 33, 44, 46}
_Button_index_1 = [...]uint8{0, 5, 10}
_Button_index_2 = [...]uint8{0, 1, 7}
_Button_index_3 = [...]uint8{0, 8, 14}
_Button_index_4 = [...]uint8{0, 2, 4, 11, 18, 23, 30, 41, 55, 70}
)
func (i Button) String() string {
switch {
case 0 <= i && i <= 5:
return _Button_name_0[_Button_index_0[i]:_Button_index_0[i+1]]
case 16 <= i && i <= 17:
i -= 16
return _Button_name_1[_Button_index_1[i]:_Button_index_1[i+1]]
case 304 <= i && i <= 305:
i -= 304
return _Button_name_2[_Button_index_2[i]:_Button_index_2[i+1]]
case 307 <= i && i <= 308:
i -= 307
return _Button_name_3[_Button_index_3[i]:_Button_index_3[i+1]]
case 310 <= i && i <= 318:
i -= 310
return _Button_name_4[_Button_index_4[i]:_Button_index_4[i+1]]
default:
return "Button(" + strconv.FormatInt(int64(i), 10) + ")"
}
}