aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-07-31 21:47:41 +0200
committernea <nea@nea.moe>2023-07-31 21:47:41 +0200
commit8b8811db65a264a4f12794e6a34c89fe1874c74b (patch)
treef1dd26b9c2f5c70f5731543953c864a3cd2bdc17 /src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
parentc3e1bab941f47dfd5ef5c55805015ee5d47da802 (diff)
downloadfirmament-8b8811db65a264a4f12794e6a34c89fe1874c74b.tar.gz
firmament-8b8811db65a264a4f12794e6a34c89fe1874c74b.tar.bz2
firmament-8b8811db65a264a4f12794e6a34c89fe1874c74b.zip
Bigger settings panel
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt b/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
index 8b4fc43..4d1f1ae 100644
--- a/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
+++ b/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
@@ -23,6 +23,7 @@ import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription
import io.github.cottonmc.cotton.gui.widget.WBox
import io.github.cottonmc.cotton.gui.widget.WButton
import io.github.cottonmc.cotton.gui.widget.WLabel
+import io.github.cottonmc.cotton.gui.widget.WScrollPanel
import io.github.cottonmc.cotton.gui.widget.data.Axis
import io.github.cottonmc.cotton.gui.widget.data.Insets
import io.github.cottonmc.cotton.gui.widget.data.VerticalAlignment
@@ -40,6 +41,7 @@ import kotlin.time.Duration
import net.minecraft.client.gui.screen.Screen
import net.minecraft.text.Text
import moe.nea.firmament.Firmament
+import moe.nea.firmament.gui.WTightScrollPanel
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.ScreenUtil.setScreenLater
@@ -195,7 +197,7 @@ abstract class ManagedConfig(val name: String) {
fun getConfigEditor(parent: Screen? = null): CottonClientScreen {
val lwgd = LightweightGuiDescription()
var screen: Screen? = null
- val guiapp = GuiAppender(400, { requireNotNull(screen) { "Screen Accessor called too early" } })
+ val guiapp = GuiAppender(400) { requireNotNull(screen) { "Screen Accessor called too early" } }
latestGuiAppender = guiapp
guiapp.panel.insets = Insets.ROOT_PANEL
guiapp.appendFullRow(WBox(Axis.HORIZONTAL).also {
@@ -210,7 +212,9 @@ abstract class ManagedConfig(val name: String) {
})
sortedOptions.forEach { it.appendToGui(guiapp) }
guiapp.reloadables.forEach { it() }
- lwgd.setRootPanel(guiapp.panel)
+ lwgd.setRootPanel(WTightScrollPanel(guiapp.panel).also {
+ it.setSize(400, 300)
+ })
screen =
object : CottonClientScreen(lwgd) {
override fun init() {