diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-16 16:27:15 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-01-16 16:27:15 +0700 |
commit | 4e587bc97c3aee3c3458a6ac60a43122f7c7971e (patch) | |
tree | ab9df90c3b5763d60ea702fd13f15461bbb56421 /src/main/kotlin/cc/woverflow/chatting/gui/components | |
parent | 42f8aa3024772e708143d49355130ef2a7999243 (diff) | |
download | Chatting-4e587bc97c3aee3c3458a6ac60a43122f7c7971e.tar.gz Chatting-4e587bc97c3aee3c3458a6ac60a43122f7c7971e.tar.bz2 Chatting-4e587bc97c3aee3c3458a6ac60a43122f7c7971e.zip |
new: remove scroll bar
new: chat background color
fix: fix chat tab buttons not having bordered text
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/gui/components')
5 files changed, 23 insertions, 5 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/CleanButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/CleanButton.kt index b67510a..f761a9a 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/CleanButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/CleanButton.kt @@ -1,6 +1,7 @@ package cc.woverflow.chatting.gui.components import cc.woverflow.chatting.Chatting +import cc.woverflow.chatting.utils.drawBorderedString import club.sk1er.patcher.config.PatcherConfig import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiButton @@ -12,7 +13,7 @@ import java.awt.Color * https://github.com/P0keDev/ChatShortcuts/blob/master/LICENSE * @author P0keDev */ -open class CleanButton(buttonId: Int, private val x: () -> Int, private val y: () -> Int, widthIn: Int, heightIn: Int, name: String) : +open class CleanButton(buttonId: Int, private val x: () -> Int, private val y: () -> Int, widthIn: Int, heightIn: Int, name: String, private val renderType: () -> RenderType) : GuiButton(buttonId, x.invoke(), 0, widthIn, heightIn, name) { open fun isEnabled(): Boolean { @@ -59,7 +60,14 @@ open class CleanButton(buttonId: Int, private val x: () -> Int, private val y: ( } else if (hovered) { j = 16777120 } - drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (height - 8) / 2, j) + when (renderType.invoke()) { + RenderType.NONE, RenderType.SHADOW -> { + drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (height - 8) / 2, j) + } + RenderType.FULL -> { + fontrenderer.drawBorderedString(displayString, (xPosition + width / 2) - (fontrenderer.getStringWidth(displayString) / 2), yPosition + (height - 8) / 2, j) + } + } } } diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/RenderType.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/RenderType.kt new file mode 100644 index 0000000..8a56d5b --- /dev/null +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/RenderType.kt @@ -0,0 +1,7 @@ +package cc.woverflow.chatting.gui.components + +enum class RenderType { + NONE, + SHADOW, + FULL +}
\ No newline at end of file diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt index 379444c..ff51a1e 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/ScreenshotButton.kt @@ -11,7 +11,8 @@ import net.minecraft.client.renderer.GlStateManager import net.minecraft.util.ResourceLocation class ScreenshotButton : - CleanButton(448318, { UResolution.scaledWidth - 28 }, { UResolution.scaledHeight - 27 }, 12, 12, "") { + CleanButton(448318, { UResolution.scaledWidth - 28 }, { UResolution.scaledHeight - 27 }, 12, 12, "", + { RenderType.NONE }) { override fun onMousePress() { val chat = Minecraft.getMinecraft().ingameGUI.chatGUI diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/SearchButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/SearchButton.kt index a0f875e..71633a3 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/SearchButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/SearchButton.kt @@ -10,7 +10,8 @@ import net.minecraft.client.renderer.GlStateManager import net.minecraft.util.ResourceLocation class SearchButton : - CleanButton(3993935, { UResolution.scaledWidth - 14 }, { UResolution.scaledHeight - 27 }, 12, 12, "") { + CleanButton(3993935, { UResolution.scaledWidth - 14 }, { UResolution.scaledHeight - 27 }, 12, 12, "", + { RenderType.NONE }) { val inputField = SearchTextField() private var chatBox = false diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt index 5342629..25190e1 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/TabButton.kt @@ -2,12 +2,13 @@ package cc.woverflow.chatting.gui.components import cc.woverflow.chatting.chat.ChatTab import cc.woverflow.chatting.chat.ChatTabs +import cc.woverflow.chatting.config.ChattingConfig import gg.essential.universal.UResolution class TabButton(buttonId: Int, x: Int, widthIn: Int, heightIn: Int, private val chatTab: ChatTab) : CleanButton(buttonId, { x }, { UResolution.scaledHeight - 26 - }, widthIn, heightIn, chatTab.name) { + }, widthIn, heightIn, chatTab.name, { RenderType.values()[ChattingConfig.textRenderType] }) { override fun onMousePress() { ChatTabs.currentTab = chatTab |