From d0ba70369d4ce30a4a0c99da65aee35d2a55abd1 Mon Sep 17 00:00:00 2001 From: ev chang Date: Thu, 13 Jun 2024 06:47:21 +0700 Subject: [PATCH] blend stuff --- src/main/kotlin/org/polyfrost/chatting/chat/ChatInputBox.kt | 1 - src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt | 1 - .../org/polyfrost/chatting/gui/components/CleanButton.kt | 4 ++++ .../org/polyfrost/chatting/gui/components/ClearButton.kt | 5 ++--- .../polyfrost/chatting/gui/components/ScreenshotButton.kt | 5 ++--- .../org/polyfrost/chatting/gui/components/SearchButton.kt | 5 ++--- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/org/polyfrost/chatting/chat/ChatInputBox.kt b/src/main/kotlin/org/polyfrost/chatting/chat/ChatInputBox.kt index 96150e6..90635c2 100644 --- a/src/main/kotlin/org/polyfrost/chatting/chat/ChatInputBox.kt +++ b/src/main/kotlin/org/polyfrost/chatting/chat/ChatInputBox.kt @@ -1,6 +1,5 @@ package org.polyfrost.chatting.chat -import cc.polyfrost.oneconfig.config.annotations.Exclude import cc.polyfrost.oneconfig.config.annotations.Switch import cc.polyfrost.oneconfig.hud.BasicHud import cc.polyfrost.oneconfig.libs.universal.UMatrixStack diff --git a/src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt b/src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt index 11ae9fc..c819c0c 100644 --- a/src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt +++ b/src/main/kotlin/org/polyfrost/chatting/chat/ChatWindow.kt @@ -136,7 +136,6 @@ class ChatWindow : BasicHud(true, 2f, 1080 - 27f - 45f - 12f) { nanoVG(true) { drawBackground(position.x, position.bottomY - animationHeight, animationWidth, animationHeight, scale) } - GlStateManager.disableBlend() GlStateManager.disableAlpha() } diff --git a/src/main/kotlin/org/polyfrost/chatting/gui/components/CleanButton.kt b/src/main/kotlin/org/polyfrost/chatting/gui/components/CleanButton.kt index ac6ce5b..b50c36a 100644 --- a/src/main/kotlin/org/polyfrost/chatting/gui/components/CleanButton.kt +++ b/src/main/kotlin/org/polyfrost/chatting/gui/components/CleanButton.kt @@ -65,6 +65,10 @@ open class CleanButton( if (visible) { val fontrenderer = mc.fontRendererObj GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f) + GlStateManager.enableAlpha() + GlStateManager.enableBlend() + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.blendFunc(770, 771) hovered = mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + width && mouseY < yPosition + height if (!Chatting.isPatcher || !PatcherConfig.transparentChatInputField) { diff --git a/src/main/kotlin/org/polyfrost/chatting/gui/components/ClearButton.kt b/src/main/kotlin/org/polyfrost/chatting/gui/components/ClearButton.kt index 8545013..9ed48fa 100644 --- a/src/main/kotlin/org/polyfrost/chatting/gui/components/ClearButton.kt +++ b/src/main/kotlin/org/polyfrost/chatting/gui/components/ClearButton.kt @@ -38,9 +38,10 @@ class ClearButton : super.drawButton(mc, mouseX, mouseY) if (visible) { GlStateManager.pushMatrix() - GlStateManager.enableBlend() GlStateManager.enableAlpha() + GlStateManager.enableBlend() GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.blendFunc(770, 771) mc.textureManager.bindTexture(ResourceLocation(Chatting.ID, "delete.png")) val color = if (hovered) chatButtonHoveredColor else chatButtonColor if (ChattingConfig.buttonShadow) { @@ -49,8 +50,6 @@ class ClearButton : } GlStateManager.color(color.red / 255f, color.green / 255f, color.blue / 255f, color.alpha / 255f) Gui.drawModalRectWithCustomSizedTexture(xPosition + 1, yPosition + 1, 0f, 0f, 10, 10, 10f, 10f) - GlStateManager.disableAlpha() - GlStateManager.disableBlend() GlStateManager.popMatrix() } } diff --git a/src/main/kotlin/org/polyfrost/chatting/gui/components/ScreenshotButton.kt b/src/main/kotlin/org/polyfrost/chatting/gui/components/ScreenshotButton.kt index b9c7370..4913367 100644 --- a/src/main/kotlin/org/polyfrost/chatting/gui/components/ScreenshotButton.kt +++ b/src/main/kotlin/org/polyfrost/chatting/gui/components/ScreenshotButton.kt @@ -28,9 +28,10 @@ class ScreenshotButton : super.drawButton(mc, mouseX, mouseY) if (visible) { GlStateManager.pushMatrix() - GlStateManager.enableBlend() GlStateManager.enableAlpha() + GlStateManager.enableBlend() GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.blendFunc(770, 771) mc.textureManager.bindTexture(ResourceLocation(Chatting.ID, "screenshot.png")) val color = if (hovered) ChattingConfig.chatButtonHoveredColor else ChattingConfig.chatButtonColor if (ChattingConfig.buttonShadow) { @@ -39,8 +40,6 @@ class ScreenshotButton : } GlStateManager.color(color.red / 255f, color.green / 255f, color.blue / 255f, color.alpha / 255f) Gui.drawModalRectWithCustomSizedTexture(xPosition + 1, yPosition + 1, 0f, 0f, 10, 10, 10f, 10f) - GlStateManager.disableAlpha() - GlStateManager.disableBlend() GlStateManager.popMatrix() } } diff --git a/src/main/kotlin/org/polyfrost/chatting/gui/components/SearchButton.kt b/src/main/kotlin/org/polyfrost/chatting/gui/components/SearchButton.kt index cbcdb80..f1a73cb 100644 --- a/src/main/kotlin/org/polyfrost/chatting/gui/components/SearchButton.kt +++ b/src/main/kotlin/org/polyfrost/chatting/gui/components/SearchButton.kt @@ -36,9 +36,10 @@ class SearchButton() : super.drawButton(mc, mouseX, mouseY) if (visible) { GlStateManager.pushMatrix() - GlStateManager.enableBlend() GlStateManager.enableAlpha() + GlStateManager.enableBlend() GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) + GlStateManager.blendFunc(770, 771) mc.textureManager.bindTexture(ResourceLocation(Chatting.ID, "search.png")) val color = if (isEnabled()) OneColor(200, 200, 200, 255) else if (hovered) ChattingConfig.chatButtonHoveredColor else ChattingConfig.chatButtonColor if (ChattingConfig.buttonShadow) { @@ -47,8 +48,6 @@ class SearchButton() : } GlStateManager.color(color.red / 255f, color.green / 255f, color.blue / 255f, color.alpha / 255f) Gui.drawModalRectWithCustomSizedTexture(xPosition + 1, yPosition + 1, 0f, 0f, 10, 10, 10f, 10f) - GlStateManager.disableAlpha() - GlStateManager.disableBlend() GlStateManager.popMatrix() } }