aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/gui
diff options
context:
space:
mode:
authorVixid <52578495+VixidDev@users.noreply.github.com>2024-04-27 12:07:55 +0100
committerGitHub <noreply@github.com>2024-04-27 13:07:55 +0200
commita15ef68de8e33df296c565d12994df2ee965626e (patch)
tree4651c999d759859988c0f169eeaf3cf4bb9bd8f8 /src/main/java/at/hannibal2/skyhanni/features/gui
parent328750a979e162ba92ec8957e81bf89989d61f63 (diff)
downloadskyhanni-a15ef68de8e33df296c565d12994df2ee965626e.tar.gz
skyhanni-a15ef68de8e33df296c565d12994df2ee965626e.tar.bz2
skyhanni-a15ef68de8e33df296c565d12994df2ee965626e.zip
Improvement: Added Outline to Custom Scoreboard (#1461)
Co-authored-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/gui')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt
index 50a51042b..2454946f5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt
@@ -5,11 +5,8 @@ import at.hannibal2.skyhanni.data.GuiEditManager
import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX
import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY
import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.alignmentConfig
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.backgroundConfig
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.config
+import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.RenderUtils
-import at.hannibal2.skyhanni.utils.SpecialColour
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.ScaledResolution
@@ -19,7 +16,10 @@ import org.lwjgl.opengl.GL11
class RenderBackground {
fun renderBackground() {
- val position = config.position
+ val alignmentConfig = CustomScoreboard.alignmentConfig
+ val backgroundConfig = CustomScoreboard.backgroundConfig
+ val outlineConfig = backgroundConfig.outline
+ val position = CustomScoreboard.config.position
val border = backgroundConfig.borderSize
val x = position.getAbsX()
@@ -36,14 +36,17 @@ class RenderBackground {
alignmentConfig.alignRight
|| alignmentConfig.alignCenterVertically
) {
+ var newX = if (alignmentConfig.alignRight) scaledWidth - elementWidth - (border * 2) else x
+ val newY = if (alignmentConfig.alignCenterVertically) scaledHeight / 2 - elementHeight / 2 else y
+
+ if (outlineConfig.enabled) {
+ newX -= outlineConfig.thickness / 2
+ }
+
position.set(
Position(
- if (alignmentConfig.alignRight)
- scaledWidth - elementWidth - (border * 2)
- else x,
- if (alignmentConfig.alignCenterVertically)
- scaledHeight / 2 - elementHeight / 2
- else y,
+ newX,
+ newY,
position.getScale(),
position.isCenter
)
@@ -76,9 +79,22 @@ class RenderBackground {
y - border,
elementWidth + border * 3,
elementHeight + border * 2,
- SpecialColour.specialToChromaRGB(backgroundConfig.color),
+ backgroundConfig.color.toChromaColor().rgb,
backgroundConfig.roundedCornerSmoothness
)
+ if (outlineConfig.enabled) {
+ RenderUtils.drawRoundRectOutline(
+ x - border,
+ y - border,
+ elementWidth + border * 3,
+ elementHeight + border * 2,
+ outlineConfig.colorTop.toChromaColor().rgb,
+ outlineConfig.colorBottom.toChromaColor().rgb,
+ outlineConfig.thickness,
+ backgroundConfig.roundedCornerSmoothness,
+ outlineConfig.blur
+ )
+ }
}
}
GL11.glDepthMask(true)