diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-19 15:06:10 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-19 15:06:10 +0100 |
commit | c5affe08dafdd45c38ae4b8dcdc1087a624e1b38 (patch) | |
tree | 0b96059daee7a96c3fd4f7df515f4f489efb245f /src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | |
parent | 1eb058d6800f9e01ac7c7696254ef955e60c80c4 (diff) | |
download | skyhanni-c5affe08dafdd45c38ae4b8dcdc1087a624e1b38.tar.gz skyhanni-c5affe08dafdd45c38ae4b8dcdc1087a624e1b38.tar.bz2 skyhanni-c5affe08dafdd45c38ae4b8dcdc1087a624e1b38.zip |
Added item scaling to farming contest timer
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 72bffdc46..388ea8a08 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -70,17 +70,26 @@ object NEUItems { fun isVanillaItem(item: ItemStack) = manager.auctionManager.isVanillaItem(item.getInternalName()) - fun ItemStack.renderOnScreen(x: Float, y: Float) { + fun ItemStack.renderOnScreen(x: Float, y: Float, scaleMultiplier: Double = 1.0) { GlStateManager.pushMatrix() val isSkull = item === Items.skull + + val baseScale = (if (isSkull) 0.8f else 0.6f) + val finalScale = baseScale * scaleMultiplier + val diff = ((finalScale - baseScale) * 10).toFloat() + + val translateX: Float + val translateY: Float if (isSkull) { - GlStateManager.translate(x - 2, y - 2, 0f) + translateX = x - 2 - diff + translateY = y - 2 - diff } else { - GlStateManager.translate(x, y, 0f) + translateX = x - diff + translateY = y - diff } - val scale = if (isSkull) 0.8f else 0.6f - GlStateManager.scale(scale, scale, 0f) + GlStateManager.translate(translateX, translateY, 0f) + GlStateManager.scale(finalScale, finalScale, 0.0) drawItemStack(this) GlStateManager.popMatrix() } |