From 5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 1 Jul 2024 03:42:51 +0200 Subject: [WIP] Remove LibGUI --- src/main/kotlin/moe/nea/firmament/gui/FixedComponent.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament/gui/FixedComponent.kt') diff --git a/src/main/kotlin/moe/nea/firmament/gui/FixedComponent.kt b/src/main/kotlin/moe/nea/firmament/gui/FixedComponent.kt index c98feda..15d6bfc 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/FixedComponent.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/FixedComponent.kt @@ -14,20 +14,20 @@ import io.github.notenoughupdates.moulconfig.observer.GetSetter import java.util.function.BiFunction class FixedComponent( - val fixedWidth: GetSetter, - val fixedHeight: GetSetter, + val fixedWidth: GetSetter?, + val fixedHeight: GetSetter?, val component: GuiComponent, ) : GuiComponent() { - override fun getWidth(): Int = fixedWidth.get() + override fun getWidth(): Int = fixedWidth?.get() ?: component.width - override fun getHeight(): Int = fixedHeight.get() + override fun getHeight(): Int = fixedHeight?.get() ?: component.height override fun foldChildren(initial: T, visitor: BiFunction): T { return visitor.apply(component, initial) } fun fixContext(context: GuiImmediateContext): GuiImmediateContext = - context.translated(0, 0, fixedWidth.get(), fixedHeight.get()) + context.translated(0, 0, width, height) override fun render(context: GuiImmediateContext) { component.render(fixContext(context)) -- cgit