Skip to content

Commit

Permalink
Merge pull request #29 from MicrocontrollersDev/main
Browse files Browse the repository at this point in the history
fix gl state on chat animations
  • Loading branch information
ImToggle authored Jan 26, 2024
2 parents 71454f6 + 7fdb451 commit f45ba4e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import cc.polyfrost.oneconfig.libs.universal.UGraphics.GL
import cc.polyfrost.oneconfig.libs.universal.UMatrixStack
import cc.polyfrost.oneconfig.utils.dsl.*
import net.minecraft.client.gui.*
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.util.ChatComponentText
import org.polyfrost.chatting.config.ChattingConfig
import org.polyfrost.chatting.utils.EaseOutQuart
Expand Down Expand Up @@ -57,6 +58,8 @@ class ChatWindow : BasicHud(true) {
val widthEnd = position.width + (if (mc.ingameGUI.chatGUI.chatOpen) 20 else 0) * scale
val heightEnd = if (height == 0) 0f else (height + paddingY * 2f) * scale
val duration = ChattingConfig.bgDuration
GlStateManager.enableAlpha()
GlStateManager.enableBlend()
if (widthEnd != widthAnimation.end) {
widthAnimation = if (ChattingConfig.smoothBG)
EaseOutQuart(duration, currentWidth, widthEnd, false)
Expand All @@ -73,6 +76,8 @@ class ChatWindow : BasicHud(true) {
nanoVG(true) {
drawBackground(position.x, position.bottomY - animationHeight, currentWidth, animationHeight, scale)
}
GlStateManager.disableBlend()
GlStateManager.disableAlpha()
}

fun getAlphaBG(): Int {
Expand Down

0 comments on commit f45ba4e

Please sign in to comment.