From de833629ec0c8f53abeb809910ef6725844e182d Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Thu, 22 Apr 2021 11:51:51 +0200 Subject: [PATCH] Add a parameter to the colorEnd method in Element.kt and make Configuration.obtained a jvm field --- .../kotlin/fr/username404/snowygui/config/Configuration.kt | 1 + .../src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt | 4 ++-- common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt index ff0eea1..406fd2b 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt @@ -14,6 +14,7 @@ object Configuration { | displayInitMessage = true |} """.trimMargin() + @JvmField val obtained: Config = run { var result: Config? = null with(file) { diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt index 00b6253..2853dc9 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/ClickBox.kt @@ -31,8 +31,8 @@ class ClickBox(x: Double, y: Double, private val name: TranslatableComponent? = tessellator.end() begin(GL20.GL_LINES, DefaultVertexFormat.POSITION_COLOR) - vertex(x + inclination, y + height, 0.0).colorIt(0xF2F2FC).endVertex() - vertex(x + width, y + height, 0.0).colorIt(0xF2F2FC).endVertex() + vertex(x + inclination, y + height, 0.0).colorEnd(0xF2F2FC) + vertex(x + width, y + height, 0.0).colorEnd(0xF2F2FC) tessellator.end() } RenderSystem.enableTexture() diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt index bfb3399..82dfbe4 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/Element.kt @@ -37,7 +37,7 @@ abstract class ColoredElement(x: Double, y: Double, width: Int, height: Int, val } } } - protected fun VertexConsumer.colorEnd() = colorIt(color, opacity).endVertex() + protected fun VertexConsumer.colorEnd(color: Int = this@ColoredElement.color) = colorIt(color, opacity).endVertex() } fun hextoRGB(hex: Int): MutableList {