Skip to content

Commit efa9394

Browse files
committed
Remove ClickGUI module and move functionality to proper configurable
1 parent 26f123c commit efa9394

File tree

19 files changed

+376
-423
lines changed

19 files changed

+376
-423
lines changed

src/main/java/com/lambda/mixin/render/GameRendererMixin.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
import com.lambda.event.EventFlow;
2121
import com.lambda.event.events.RenderEvent;
2222
import com.lambda.graphics.RenderMain;
23-
import com.lambda.gui.DearImGui;
24-
import com.lambda.gui.LambdaScreen;
25-
import com.lambda.module.modules.client.ClickGui;
2623
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2724
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2825
import net.minecraft.client.render.Camera;

src/main/kotlin/com/lambda/Lambda.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import com.lambda.config.serializer.OptionalSerializer
2929
import com.lambda.core.Loader
3030
import com.lambda.event.events.ClientEvent
3131
import com.lambda.event.listener.UnsafeListener.Companion.listenOnceUnsafe
32-
import com.lambda.module.modules.client.ClickGui
32+
import com.lambda.gui.components.ClickGuiLayout
3333
import com.lambda.util.KeyCode
3434
import com.lambda.util.WindowIcons.setLambdaWindowIcon
3535
import com.mojang.authlib.GameProfile
@@ -82,7 +82,7 @@ object Lambda : ClientModInitializer {
8282
// We want the opengl context to be created
8383
listenOnceUnsafe<ClientEvent.Startup>(priority = Int.MAX_VALUE) {
8484
LOG.info("$MOD_NAME $VERSION initialized in ${Loader.initialize()} ms\n")
85-
if (ClickGui.setLambdaWindowIcon) setLambdaWindowIcon()
85+
if (ClickGuiLayout.setLambdaWindowIcon) setLambdaWindowIcon()
8686
true
8787
}
8888
}

src/main/kotlin/com/lambda/graphics/renderer/gui/AbstractGUIRenderer.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ import com.lambda.graphics.buffer.vertex.attributes.VertexAttrib
2424
import com.lambda.graphics.buffer.vertex.attributes.VertexMode
2525
import com.lambda.graphics.pipeline.VertexPipeline
2626
import com.lambda.graphics.shader.Shader
27-
import com.lambda.module.modules.client.GuiSettings
28-
import com.lambda.module.modules.client.GuiSettings.primaryColor
29-
import com.lambda.module.modules.client.GuiSettings.secondaryColor
27+
import com.lambda.gui.components.ClickGuiLayout
3028
import com.lambda.module.modules.client.StyleEditor
3129
import com.lambda.util.math.MathUtils.toInt
3230
import com.lambda.util.math.Vec2d
@@ -59,11 +57,11 @@ open class AbstractGUIRenderer(
5957

6058
shader["u_Shade"] = shade.toInt().toDouble()
6159
if (shade) {
62-
shader["u_ShadeTime"] = GLFW.glfwGetTime() * GuiSettings.colorSpeed * 5.0
63-
shader["u_ShadeColor1"] = primaryColor
64-
shader["u_ShadeColor2"] = secondaryColor
60+
shader["u_ShadeTime"] = GLFW.glfwGetTime() * ClickGuiLayout.colorSpeed * 5.0
61+
shader["u_ShadeColor1"] = ClickGuiLayout.primaryColor
62+
shader["u_ShadeColor2"] = ClickGuiLayout.secondaryColor
6563

66-
shader["u_ShadeSize"] = RenderMain.screenSize / Vec2d(GuiSettings.colorWidth, GuiSettings.colorHeight)
64+
shader["u_ShadeSize"] = RenderMain.screenSize / Vec2d(ClickGuiLayout.colorWidth, ClickGuiLayout.colorHeight)
6765
}
6866

6967
pipeline.apply {

src/main/kotlin/com/lambda/graphics/renderer/gui/FontRenderer.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import com.lambda.graphics.renderer.gui.font.core.LambdaAtlas.get
2424
import com.lambda.graphics.renderer.gui.font.core.LambdaAtlas.height
2525
import com.lambda.graphics.shader.Shader.Companion.shader
2626
import com.lambda.graphics.texture.TextureOwner.bind
27-
import com.lambda.module.modules.client.ClickGui
27+
import com.lambda.gui.components.ClickGuiLayout
2828
import com.lambda.module.modules.client.LambdaMoji
2929
import com.lambda.module.modules.client.StyleEditor
3030
import com.lambda.util.math.MathUtils.toInt
@@ -59,7 +59,7 @@ object FontRenderer : AbstractGUIRenderer(VertexAttrib.Group.FONT, shader("rende
5959
text: String,
6060
position: Vec2d = Vec2d.ZERO,
6161
color: Color = Color.WHITE,
62-
scale: Double = ClickGui.fontScale,
62+
scale: Double = ClickGuiLayout.fontScale,
6363
shadow: Boolean = true,
6464
parseEmoji: Boolean = LambdaMoji.isEnabled
6565
) = render {
@@ -89,7 +89,7 @@ object FontRenderer : AbstractGUIRenderer(VertexAttrib.Group.FONT, shader("rende
8989
glyph: GlyphInfo,
9090
position: Vec2d,
9191
color: Color = Color.WHITE,
92-
scale: Double = ClickGui.fontScale,
92+
scale: Double = ClickGuiLayout.fontScale,
9393
) = render {
9494
shader["u_FontTexture"] = 0
9595
shader["u_EmojiTexture"] = 1
@@ -157,7 +157,7 @@ object FontRenderer : AbstractGUIRenderer(VertexAttrib.Group.FONT, shader("rende
157157
*/
158158
fun getWidth(
159159
text: String,
160-
scale: Double = ClickGui.fontScale,
160+
scale: Double = ClickGuiLayout.fontScale,
161161
parseEmoji: Boolean = LambdaMoji.isEnabled,
162162
): Double {
163163
var width = 0.0

src/main/kotlin/com/lambda/graphics/renderer/gui/TextureRenderer.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ import com.lambda.graphics.buffer.vertex.attributes.VertexMode
2323
import com.lambda.graphics.pipeline.VertexPipeline
2424
import com.lambda.graphics.shader.Shader.Companion.shader
2525
import com.lambda.graphics.texture.Texture
26-
import com.lambda.module.modules.client.GuiSettings
27-
import com.lambda.module.modules.client.GuiSettings.primaryColor
28-
import com.lambda.module.modules.client.GuiSettings.secondaryColor
26+
import com.lambda.gui.components.ClickGuiLayout
2927
import com.lambda.util.math.Rect
3028
import com.lambda.util.math.Vec2d
3129
import org.lwjgl.glfw.GLFW.glfwGetTime
@@ -48,11 +46,11 @@ object TextureRenderer {
4846
coloredShader.use()
4947

5048
coloredShader["u_Shade"] = 1.0
51-
coloredShader["u_ShadeTime"] = glfwGetTime() * GuiSettings.colorSpeed * 5.0
52-
coloredShader["u_ShadeColor1"] = primaryColor
53-
coloredShader["u_ShadeColor2"] = secondaryColor
49+
coloredShader["u_ShadeTime"] = glfwGetTime() * ClickGuiLayout.colorSpeed * 5.0
50+
coloredShader["u_ShadeColor1"] = ClickGuiLayout.primaryColor
51+
coloredShader["u_ShadeColor2"] = ClickGuiLayout.secondaryColor
5452

55-
coloredShader["u_ShadeSize"] = RenderMain.screenSize / Vec2d(GuiSettings.colorWidth, GuiSettings.colorHeight)
53+
coloredShader["u_ShadeSize"] = RenderMain.screenSize / Vec2d(ClickGuiLayout.colorWidth, ClickGuiLayout.colorHeight)
5654

5755
drawInternal(rect)
5856
}

src/main/kotlin/com/lambda/gui/DearImGui.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import com.lambda.Lambda.mc
2121
import com.lambda.core.Loadable
2222
import com.lambda.event.EventFlow.post
2323
import com.lambda.event.events.GuiEvent
24-
import com.lambda.module.modules.client.ClickGui
25-
import com.lambda.module.modules.client.GuiSettings
24+
import com.lambda.gui.components.ClickGuiLayout
2625
import com.lambda.util.stream
2726
import com.mojang.blaze3d.opengl.GlStateManager
2827
import com.mojang.blaze3d.systems.RenderSystem
@@ -76,7 +75,7 @@ object DearImGui : Loadable {
7675
}
7776

7877
fun render() {
79-
val scale = (GuiSettings.scaleSetting / 100.0).toFloat()
78+
val scale = (ClickGuiLayout.scaleSetting / 100.0).toFloat()
8079

8180
if (lastScale == 0f) {
8281
targetScale = scale
@@ -109,7 +108,7 @@ object DearImGui : Loadable {
109108
implGlfw.newFrame()
110109
implGl3.newFrame()
111110

112-
ClickGui.applyStyle(lastScale)
111+
ClickGuiLayout.applyStyle(lastScale)
113112
ImGui.newFrame()
114113

115114
GuiEvent.NewFrame.post()

src/main/kotlin/com/lambda/gui/LambdaScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
package com.lambda.gui
1919

20-
import com.lambda.module.modules.client.ClickGui
20+
import com.lambda.gui.components.ClickGuiLayout
2121
import net.minecraft.client.gui.DrawContext
2222
import net.minecraft.client.gui.screen.Screen
2323
import net.minecraft.text.Text
2424

2525
object LambdaScreen : Screen(Text.of("Lambda")) {
2626
override fun shouldPause() = false
27-
override fun removed() = ClickGui.disable()
27+
override fun removed() = ClickGuiLayout.close()
2828
override fun render(context: DrawContext?, mouseX: Int, mouseY: Int, deltaTicks: Float) {}
2929
}

src/main/kotlin/com/lambda/gui/MenuBar.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import com.lambda.core.Loader
2626
import com.lambda.event.EventFlow
2727
import com.lambda.graphics.texture.TextureOwner.upload
2828
import com.lambda.gui.DearImGui.EXTERNAL_LINK
29+
import com.lambda.gui.components.ClickGuiLayout
2930
import com.lambda.gui.components.HudGuiLayout
3031
import com.lambda.gui.components.QuickSearch
3132
import com.lambda.gui.components.SettingsWidget.buildConfigSettingsContext
@@ -58,6 +59,7 @@ object MenuBar {
5859
mainMenuBar {
5960
lambdaMenu()
6061
menu("HUD") { buildHudMenu() }
62+
menu("GUI") { buildGuiMenu() }
6163
menu("Modules") { buildModulesMenu() }
6264
menu("Minecraft") { buildMinecraftMenu() }
6365
menu("Help") { buildHelpMenu() }
@@ -205,6 +207,10 @@ object MenuBar {
205207
}
206208
}
207209

210+
private fun ImGuiBuilder.buildGuiMenu() {
211+
buildConfigSettingsContext(ClickGuiLayout)
212+
}
213+
208214
private fun ImGuiBuilder.buildModulesMenu() {
209215
menu("Module Tag") {
210216
ModuleTag.defaults.forEach { tag ->

0 commit comments

Comments
 (0)