Skip to content

Commit e3a2e03

Browse files
committed
Add new textures for export, disabled buttons, and clear grid hover
1 parent cdfea9c commit e3a2e03

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

Common/src/main/kotlin/gay/object/hexdebug/gui/splicing/SplicingTableScreen.kt

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,11 @@ class SplicingTableScreen(
7171

7272
private val iotaButtons = mutableListOf<AbstractButton>()
7373
private val edgeButtons = mutableListOf<AbstractButton>()
74-
private val viewButtons = mutableListOf<AbstractButton>()
75-
private val staffButtons = mutableListOf<AbstractButton>()
7674
private val predicateButtons = mutableListOf<Pair<AbstractButton, () -> Boolean>>()
7775

7876
private val listReadButtons = sequenceOf(
7977
iotaButtons,
8078
edgeButtons,
81-
viewButtons,
82-
staffButtons,
8379
).flatten()
8480

8581
private val allButtons = sequenceOf(
@@ -110,7 +106,6 @@ class SplicingTableScreen(
110106

111107
iotaButtons.clear()
112108
edgeButtons.clear()
113-
viewButtons.clear()
114109
predicateButtons.clear()
115110

116111
iotaButtons += (0 until IOTA_BUTTONS).map { offset ->
@@ -127,13 +122,6 @@ class SplicingTableScreen(
127122
.build()
128123
}
129124

130-
viewButtons += listOf(
131-
button("export") { exportToSystemClipboard() }
132-
.pos(leftPos + imageWidth + 2, topPos)
133-
.size(128, 16)
134-
.build()
135-
)
136-
137125
clearGridButton = object : SpriteButton(
138126
x = (staffMinX + staffMaxX) / 2 - 19,
139127
y = staffMaxY - 10,
@@ -146,7 +134,7 @@ class SplicingTableScreen(
146134
guiSpellcasting.mixin.`clearPatterns$hexdebug`()
147135
},
148136
) {
149-
override val uOffsetHovered get() = uOffset
137+
override val uOffsetHovered get() = uOffset - 48
150138
override val vOffsetHovered get() = vOffset
151139

152140
override val uOffsetDisabled get() = uOffset
@@ -159,41 +147,54 @@ class SplicingTableScreen(
159147
}.also(::addRenderableWidget)
160148

161149
predicateButtons += listOf(
150+
// export hexpattern
151+
object : SpriteButton(
152+
x = leftPos + 194,
153+
y = topPos + 18,
154+
uOffset = 432,
155+
vOffset = 392,
156+
width = 24,
157+
height = 24,
158+
message = buttonText("export"),
159+
onPress = {
160+
exportToSystemClipboard()
161+
},
162+
) {
163+
override val uOffsetHovered get() = uOffset
164+
override val vOffsetHovered get() = vOffset + 32
165+
166+
override val uOffsetDisabled get() = uOffset
167+
override val vOffsetDisabled get() = vOffset + 64
168+
} to { // test
169+
true
170+
},
171+
162172
// move view
163173

164-
object : SpriteButton(
174+
SpriteButton(
165175
x = leftPos + 4,
166176
y = topPos + 25,
167177
uOffset = 256,
168178
vOffset = 0,
169179
width = 10,
170180
height = 10,
171181
message = buttonText("view_left"),
172-
onPress = {
173-
moveView(-1)
174-
},
175-
) {
176-
// TODO: remove when sam adds a disabled texture lol
177-
override val uOffsetDisabled get() = uOffset
178-
override val vOffsetDisabled get() = vOffset
182+
) { // onPress
183+
moveView(-1)
179184
} to { // test
180185
viewStartIndex > 0
181186
},
182187

183-
object : SpriteButton(
188+
SpriteButton(
184189
x = leftPos + 178,
185190
y = topPos + 25,
186191
uOffset = 266,
187192
vOffset = 0,
188193
width = 10,
189194
height = 10,
190195
message = buttonText("view_right"),
191-
onPress = {
192-
moveView(1)
193-
},
194-
) {
195-
override val uOffsetDisabled get() = uOffset
196-
override val vOffsetDisabled get() = vOffset
196+
) { // onPress
197+
moveView(1)
197198
} to { // test
198199
viewStartIndex < data.lastIndex - IOTA_BUTTONS + 1
199200
},
@@ -593,8 +594,6 @@ class SplicingTableScreen(
593594
// rendering
594595

595596
override fun render(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) {
596-
staffButtons.forEach { it.visible = hasStaffItem }
597-
598597
renderBackground(guiGraphics)
599598
super.render(guiGraphics, mouseX, mouseY, partialTick)
600599
renderTooltip(guiGraphics, mouseX, mouseY)
2.19 KB
Loading

0 commit comments

Comments
 (0)