aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui/WBar.kt
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-06-01 23:10:09 +0200
committernea <nea@nea.moe>2023-06-01 23:10:09 +0200
commit7c60db4fbf6b67dc5144436d2387331219128d3c (patch)
tree53eb08b732d802ab76b39a4f650aaf9fc5564a53 /src/main/kotlin/moe/nea/firmament/gui/WBar.kt
parent6e3c41fbafd837b891bc01e3baa0424effcdb734 (diff)
downloadfirmament-7c60db4fbf6b67dc5144436d2387331219128d3c.tar.gz
firmament-7c60db4fbf6b67dc5144436d2387331219128d3c.tar.bz2
firmament-7c60db4fbf6b67dc5144436d2387331219128d3c.zip
Profile Viewer Skill Page v1
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/gui/WBar.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/WBar.kt16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/WBar.kt b/src/main/kotlin/moe/nea/firmament/gui/WBar.kt
index 879805d..04c5e3d 100644
--- a/src/main/kotlin/moe/nea/firmament/gui/WBar.kt
+++ b/src/main/kotlin/moe/nea/firmament/gui/WBar.kt
@@ -1,5 +1,6 @@
package moe.nea.firmament.gui
+import com.mojang.blaze3d.systems.RenderSystem
import io.github.cottonmc.cotton.gui.client.ScreenDrawing
import io.github.cottonmc.cotton.gui.widget.WWidget
import io.github.cottonmc.cotton.gui.widget.data.Texture
@@ -7,17 +8,19 @@ import me.shedaniel.math.Color
import net.minecraft.client.util.math.MatrixStack
import moe.nea.firmament.Firmament
-data class WBar(
+open class WBar(
var progress: Double,
val total: Double,
val fillColor: Color,
val emptyColor: Color,
) : WWidget() {
- val resource = Firmament.identifier("textures/gui/bar.png")
- val left = Texture(resource, 0 / 64F, 0 / 64F, 4 / 64F, 8 / 64F)
- val middle = Texture(resource, 4 / 64F, 0 / 64F, 4 / 64F, 8 / 64F)
- val right = Texture(resource, 8 / 64F, 0 / 64F, 4 / 64F, 8 / 64F)
- val segmentOverlay = Texture(resource, 12 / 64F, 0 / 64F, 15 / 64F, 8 / 64F)
+ companion object {
+ val resource = Firmament.identifier("textures/gui/bar.png")
+ val left = Texture(resource, 0 / 64F, 0 / 64F, 4 / 64F, 8 / 64F)
+ val middle = Texture(resource, 4 / 64F, 0 / 64F, 8 / 64F, 8 / 64F)
+ val right = Texture(resource, 8 / 64F, 0 / 64F, 12 / 64F, 8 / 64F)
+ val segmentOverlay = Texture(resource, 12 / 64F, 0 / 64F, 15 / 64F, 8 / 64F)
+ }
override fun canResize(): Boolean {
return true
@@ -65,5 +68,6 @@ data class WBar(
i += 4
}
drawSection(matrices, right, x + width - 4, y, 4, (width - 4) * total / width, total)
+ RenderSystem.setShaderColor(1F, 1F, 1F, 1F)
}
}