aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-04-09 21:10:31 +0200
committerGitHub <noreply@github.com>2024-04-09 21:10:31 +0200
commit161ec2ae95b770ad7aa5571ff44dadcab9202790 (patch)
treee41ff752b486a29c2651b2b3a89c5223262fcee1 /src/main/java/at/hannibal2/skyhanni
parent53f17cb2b8682314a5eba3986245e3de9f8cdd60 (diff)
downloadskyhanni-161ec2ae95b770ad7aa5571ff44dadcab9202790.tar.gz
skyhanni-161ec2ae95b770ad7aa5571ff44dadcab9202790.tar.bz2
skyhanni-161ec2ae95b770ad7aa5571ff44dadcab9202790.zip
Backend: Renderable.renderInsideRoundedRect (#890)
Co-authored-by: VixidDev <52578495+VixidDev@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
index 9c7116e07..f3961660d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NEUItems.renderOnScreen
+import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment
import at.hannibal2.skyhanni.utils.RenderUtils.VerticalAlignment
import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.calculateTableXOffsets
@@ -545,5 +546,27 @@ interface Renderable {
GlStateManager.translate(0f, -height.toFloat() - spacing.toFloat(), 0f)
}
}
+
+ fun drawInsideRoundedRect(
+ input: Renderable,
+ color: Color,
+ padding: Int = 2,
+ radius: Int = 10,
+ smoothness: Int = 2,
+ horizontalAlign: HorizontalAlignment = HorizontalAlignment.LEFT,
+ verticalAlign: VerticalAlignment = VerticalAlignment.TOP,
+ ) = object : Renderable {
+ override val width = input.width + padding * 2
+ override val height = input.height + padding * 2
+ override val horizontalAlign = horizontalAlign
+ override val verticalAlign = verticalAlign
+
+ override fun render(posX: Int, posY: Int) {
+ RenderUtils.drawRoundRect(0, 0, width, height, color.rgb, radius, smoothness)
+ GlStateManager.translate(padding.toFloat(), padding.toFloat(), 0f)
+ input.render(posX + padding, posY + padding)
+ GlStateManager.translate(-padding.toFloat(), -padding.toFloat(), 0f)
+ }
+ }
}
}