aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
+ }
+ }
}
}