tangled
alpha
login
or
join now
voigt.tngl.sh
/
luminos
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
1
pipelines
add numItem type for config list
voigt.tngl.sh
2 weeks ago
a91721db
086b1e26
verified
This commit was signed with the committer's
known signature
.
voigt.tngl.sh
SSH Key Fingerprint:
SHA256:6ShT3iHt6IpCPJtT9Ndevva6c3xzr4RI2LrvKeOXH2U=
+26
-28
1 changed file
expand all
collapse all
unified
split
screen_config.go
+26
-28
screen_config.go
···
58
58
}
59
59
}
60
60
61
61
+
func numItem(key string, values []int, get func() int, set func(int)) ConfigItem {
62
62
+
idx := uint8(0)
63
63
+
var a []any
64
64
+
for i, v := range values {
65
65
+
a = append(a, v)
66
66
+
if values[i] == get() {
67
67
+
idx = uint8(i)
68
68
+
}
69
69
+
}
70
70
+
return ConfigItem{
71
71
+
Key: key,
72
72
+
values: a,
73
73
+
label: func(v any) string { return strconv.Itoa(v.(int)) },
74
74
+
selectedIdx: idx,
75
75
+
callback: func(v any) { set(v.(int)) },
76
76
+
}
77
77
+
}
78
78
+
61
79
func blockBagItem() ConfigItem {
62
80
values := []any{BlockBagRandom, BlockBagSevenBag}
63
81
idx := uint8(0)
···
97
115
98
116
func (cs *ConfigScreen) OnEnter() {
99
117
cs.ConfigList = []ConfigItem{
100
100
-
{
101
101
-
Key: "Level",
102
102
-
values: []any{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
103
103
-
label: func(v any) string { return strconv.Itoa(v.(int)) },
104
104
-
selectedIdx: func() uint8 {
105
105
-
for i, v := range []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} {
106
106
-
if v == CONFIG.Level {
107
107
-
return uint8(i)
108
108
-
}
109
109
-
}
110
110
-
return 0
111
111
-
}(),
112
112
-
callback: func(v any) { CONFIG.Level = v.(int) },
113
113
-
},
118
118
+
numItem("Level",
119
119
+
[]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
120
120
+
func() int { return CONFIG.Level },
121
121
+
func(v int) { CONFIG.Level = v }),
114
122
boolItem("Show Drop Shadow",
115
123
func() bool { return CONFIG.DropShadow.Enabled },
116
124
func(v bool) { CONFIG.DropShadow.Enabled = v }),
···
124
132
func() bool { return CONFIG.SoftDropPointsEnabled },
125
133
func(v bool) { CONFIG.SoftDropPointsEnabled = v }),
126
134
blockBagItem(),
127
127
-
{
128
128
-
Key: "Next Blocks",
129
129
-
values: []any{1, 2, 3, 4, 5},
130
130
-
label: func(v any) string { return strconv.Itoa(v.(int)) },
131
131
-
selectedIdx: func() uint8 {
132
132
-
for i, v := range []int{1, 2, 3, 4, 5} {
133
133
-
if v == CONFIG.NextBlock.Count {
134
134
-
return uint8(i)
135
135
-
}
136
136
-
}
137
137
-
return 0
138
138
-
}(),
139
139
-
callback: func(v any) { CONFIG.NextBlock.Count = v.(int) },
140
140
-
},
135
135
+
numItem("Next Blocks",
136
136
+
[]int{1, 2, 3, 4, 5},
137
137
+
func() int { return CONFIG.NextBlock.Count },
138
138
+
func(v int) { CONFIG.NextBlock.Count = v }),
141
139
blockColorItem("Background",
142
140
func() ff.Color { return CONFIG.Background },
143
141
func(c ff.Color) { CONFIG.Background = c }),