From 0c19f262e5d2690236dbfffd4eca361e39786f5d Mon Sep 17 00:00:00 2001 From: minecraft-simon Date: Sun, 18 Dec 2022 17:37:04 +0100 Subject: [PATCH 1/4] set rubberbanding speed default value to be equal to lambda 3.2.1 --- .../kotlin/com/lambda/client/module/modules/client/ClickGUI.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/client/ClickGUI.kt b/src/main/kotlin/com/lambda/client/module/modules/client/ClickGUI.kt index 3705939aa..17f97fea7 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/client/ClickGUI.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/client/ClickGUI.kt @@ -32,7 +32,7 @@ object ClickGUI : Module( val fadeInTime by setting("Fade In Time", 0.25f, 0.0f..1.0f, 0.05f, unit = "s") val fadeOutTime by setting("Fade Out Time", 0.1f, 0.0f..1.0f, 0.05f, unit = "s") val scrollRubberband by setting("Scroll Rubberband", false) - val scrollRubberbandSpeed by setting("Scroll Rubberband Speed", 0.5f, 0.01f..1.0f, 0.05f, { scrollRubberband }) + val scrollRubberbandSpeed by setting("Scroll Rubberband Speed", 0.25f, 0.01f..1.0f, 0.05f, { scrollRubberband }) val showModifiedInBold by setting("Show Modified In Bold", false, description = "Display modified settings in a bold font") private val resetComponents = setting("Reset Positions", false) private val resetScale = setting("Reset Scale", false) From ac3bc7072dfdbd11c0042e16869833c779ed761b Mon Sep 17 00:00:00 2001 From: minecraft-simon Date: Sun, 18 Dec 2022 19:11:26 +0100 Subject: [PATCH 2/4] added dots to the module window resize handles --- .../client/gui/clickgui/LambdaClickGui.kt | 2 +- .../gui/clickgui/component/PluginWindow.kt | 2 +- .../client/gui/rgui/windows/ListWindow.kt | 28 +++++++++++++++---- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/gui/clickgui/LambdaClickGui.kt b/src/main/kotlin/com/lambda/client/gui/clickgui/LambdaClickGui.kt index 7de0eef7f..693c7f78e 100644 --- a/src/main/kotlin/com/lambda/client/gui/clickgui/LambdaClickGui.kt +++ b/src/main/kotlin/com/lambda/client/gui/clickgui/LambdaClickGui.kt @@ -41,7 +41,7 @@ object LambdaClickGui : AbstractLambdaGui() var posX = 0.0f Category.values().forEach { category -> - val window = ListWindow(category.displayName, posX, 0.0f, 90.0f, 300.0f, Component.SettingGroup.CLICK_GUI) + val window = ListWindow(category.displayName, posX, 0.0f, 90.0f, 300.0f, Component.SettingGroup.CLICK_GUI, drawHandle = true) windows.add(window) posX += 90.0f diff --git a/src/main/kotlin/com/lambda/client/gui/clickgui/component/PluginWindow.kt b/src/main/kotlin/com/lambda/client/gui/clickgui/component/PluginWindow.kt index 22cf83fcc..2db6ef8d8 100644 --- a/src/main/kotlin/com/lambda/client/gui/clickgui/component/PluginWindow.kt +++ b/src/main/kotlin/com/lambda/client/gui/clickgui/component/PluginWindow.kt @@ -6,7 +6,7 @@ class PluginWindow( cname: String, cPosX: Float, cPosY: Float, -) : ListWindow(cname, cPosX, cPosY, 120.0f, 200.0f, SettingGroup.CLICK_GUI) { +) : ListWindow(cname, cPosX, cPosY, 120.0f, 200.0f, SettingGroup.CLICK_GUI, drawHandle = true) { override val minHeight: Float get() = 100.0f } \ No newline at end of file diff --git a/src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt b/src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt index 026f6045a..6917c5444 100644 --- a/src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt +++ b/src/main/kotlin/com/lambda/client/gui/rgui/windows/ListWindow.kt @@ -5,9 +5,13 @@ import com.lambda.client.gui.AbstractLambdaGui import com.lambda.client.gui.rgui.Component import com.lambda.client.gui.rgui.InteractiveComponent import com.lambda.client.module.modules.client.ClickGUI +import com.lambda.client.module.modules.client.CustomFont +import com.lambda.client.module.modules.client.GuiColors import com.lambda.client.util.TickTimer +import com.lambda.client.util.color.ColorHolder import com.lambda.client.util.graphics.GlStateUtils import com.lambda.client.util.graphics.VertexHelper +import com.lambda.client.util.graphics.font.FontRenderAdapter import com.lambda.client.util.math.Vec2f import org.lwjgl.input.Mouse import org.lwjgl.opengl.GL11.* @@ -21,7 +25,8 @@ open class ListWindow( width: Float, height: Float, saveToConfig: SettingGroup, - vararg childrenIn: Component + vararg childrenIn: Component, + val drawHandle: Boolean = false ) : TitledWindow(name, posX, posY, width, height, saveToConfig) { val children = ArrayList() @@ -147,6 +152,17 @@ open class ListWindow( override fun onRender(vertexHelper: VertexHelper, absolutePos: Vec2f) { super.onRender(vertexHelper, absolutePos) + if (drawHandle) { + val handleText = "....." + val scale = 0.75f + val posX = renderWidth / 2 - FontRenderAdapter.getStringWidth(handleText, scale) / 2 + val posY = renderHeight - 5 - FontRenderAdapter.getFontHeight(scale) / 2 + val color = with(GuiColors.text) { + ColorHolder(r, g, b, (a * 0.6f).toInt()) + } + FontRenderAdapter.drawString(handleText, posX, posY, CustomFont.shadow, color, scale) + } + synchronized(this) { renderChildren { it.onRender(vertexHelper, absolutePos.plus(it.renderPosX, it.renderPosY - renderScrollProgress)) @@ -171,14 +187,15 @@ open class ListWindow( ((renderPosX + ClickGUI.horizontalMargin) * ClickGUI.getScaleFactor()).toInt(), mc.displayHeight - ((renderPosY + renderHeight - ClickGUI.resizeBar) * ClickGUI.getScaleFactor()).toInt(), ((renderWidth - ClickGUI.horizontalMargin) * ClickGUI.getScaleFactor()).toInt(), - ((renderHeight - draggableHeight - ClickGUI.resizeBar)* ClickGUI.getScaleFactor()).toInt().coerceAtLeast(0) + ((renderHeight - draggableHeight - ClickGUI.resizeBar) * ClickGUI.getScaleFactor()).toInt().coerceAtLeast(0) ) glEnable(GL_SCISSOR_TEST) glTranslatef(0.0f, -renderScrollProgress, 0.0f) - children.filter { it.visible - && it.renderPosY + it.renderHeight - renderScrollProgress > draggableHeight - && it.renderPosY - renderScrollProgress < renderHeight + children.filter { + it.visible + && it.renderPosY + it.renderHeight - renderScrollProgress > draggableHeight + && it.renderPosY - renderScrollProgress < renderHeight }.forEach { glPushMatrix() glTranslatef(it.renderPosX, it.renderPosY, 0.0f) @@ -211,7 +228,6 @@ open class ListWindow( || relativeMousePos.x < ClickGUI.horizontalMargin || relativeMousePos.x > renderWidth - ClickGUI.horizontalMargin ) null - else children.firstOrNull { it.visible && relativeMousePos.y in it.posY..it.posY + it.height } } From 566a3917f296559178b1fab875ebb53ef871daa1 Mon Sep 17 00:00:00 2001 From: minecraft-simon Date: Mon, 19 Dec 2022 20:26:39 +0100 Subject: [PATCH 3/4] restored scroll responsiveness --- src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt b/src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt index 70333af61..d9314ab35 100644 --- a/src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt +++ b/src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt @@ -198,6 +198,7 @@ abstract class AbstractLambdaGui, E : Any> : GuiScreen() { } } + hoveredWindow?.onMouseInput(mousePos) super.handleMouseInput() updateSettingWindow() } From 901dc927d82ad3adec5cafb80daaa98dba08e221 Mon Sep 17 00:00:00 2001 From: Constructor Date: Wed, 21 Dec 2022 20:16:50 +0100 Subject: [PATCH 4/4] Remove the line that broke scrolling --- src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt b/src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt index d9314ab35..55b77b2d6 100644 --- a/src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt +++ b/src/main/kotlin/com/lambda/client/gui/AbstractLambdaGui.kt @@ -45,7 +45,7 @@ abstract class AbstractLambdaGui, E : Any> : GuiScreen() { // Mouse private var lastEventButton = -1 - private var lastClickPos = Vec2f(0.0f, 0.0f) + private var lastClickPos = Vec2f.ZERO // Searching protected var typedString = "" @@ -285,8 +285,6 @@ abstract class AbstractLambdaGui, E : Any> : GuiScreen() { drawTypedString() GlStateUtils.depth(false) - - hoveredWindow?.onMouseInput(getRealMousePos()) } private fun drawBackground(vertexHelper: VertexHelper, partialTicks: Float) {