Skip to content

Commit f483efb

Browse files
committed
Merge remote-tracking branch 'origin/refactor/ui' into refactor/ui
2 parents 20c4aac + 87ecb9c commit f483efb

File tree

6 files changed

+58
-7
lines changed

6 files changed

+58
-7
lines changed

common/src/main/kotlin/com/lambda/gui/impl/clickgui/module/settings/EnumSlider.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class EnumSlider <T : Enum<T>>(
2727
owner: Layout,
2828
setting: EnumSetting<T>
2929
) : SettingSlider<T, EnumSetting<T>>(owner, setting) {
30+
override val settingValue: String
31+
get() = settingDelegate.name
32+
3033
init {
3134
slider.progress {
3235
transform(

common/src/main/kotlin/com/lambda/gui/impl/clickgui/module/settings/NumberSlider.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class NumberSlider <V> (
3131
private val min = setting.range.start.toDouble()
3232
private val max = setting.range.endInclusive.toDouble()
3333

34+
override val settingValue: String
35+
get() = "${setting.value}${setting.unit}"
36+
3437
init {
3538
slider.progress {
3639
transform(

common/src/main/kotlin/com/lambda/gui/impl/clickgui/module/settings/SettingSlider.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import com.lambda.util.math.lerp
3131
abstract class SettingSlider <V : Any, T: AbstractSetting<V>>(
3232
owner: Layout, setting: T
3333
) : SettingLayout<V, T>(owner, setting, false) {
34+
abstract val settingValue: String
35+
3436
private var changeAnimation by animation.exp(0.0, 1.0, 0.5) { true }
3537

3638
private val sliderHeight = 3.0
@@ -62,7 +64,7 @@ abstract class SettingSlider <V : Any, T: AbstractSetting<V>>(
6264

6365
onUpdate {
6466
lastValue = text
65-
text = settingDelegate.toString()
67+
text = settingValue
6668
if (lastValue != text) changeAnimation = 0.0
6769

6870
offsetX = textField.offsetX

common/src/main/kotlin/com/lambda/module/Module.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import com.lambda.event.listener.Listener
3131
import com.lambda.event.listener.SafeListener
3232
import com.lambda.event.listener.SafeListener.Companion.listen
3333
import com.lambda.event.listener.UnsafeListener
34+
import com.lambda.module.hud.ModuleList
3435
import com.lambda.module.tag.ModuleTag
3536
import com.lambda.sound.LambdaSound
3637
import com.lambda.sound.SoundManager.playSoundRandomly
@@ -116,9 +117,9 @@ abstract class Module(
116117
) : Nameable, Muteable, Configurable(ModuleConfig) {
117118
private val isEnabledSetting = setting("Enabled", enabledByDefault, visibility = { false })
118119
private val keybindSetting = setting("Keybind", defaultKeybind)
119-
private val isVisible = setting("Visible", true)
120+
val isVisible = setting("Visible", true) { ModuleList.isEnabled }
120121
val reset by setting("Reset", { settings.forEach { it.reset() }; this@Module.info("Settings set to default") })
121-
val customTags = setting("Tags", setOf<ModuleTag>(), visibility = { false })
122+
val customTags = setting("Tags", setOf<ModuleTag>()) { false }
122123

123124
var isEnabled by isEnabledSetting
124125
val isDisabled get() = !isEnabled
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2024 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.module.hud
19+
20+
import com.lambda.graphics.renderer.gui.font.FontRenderer.drawString
21+
import com.lambda.module.HudModule
22+
import com.lambda.module.ModuleRegistry
23+
import com.lambda.module.tag.ModuleTag
24+
import com.lambda.task.TaskFlow
25+
import com.lambda.util.math.Vec2d
26+
27+
object ModuleList : HudModule(
28+
name = "ModuleList",
29+
defaultTags = setOf(ModuleTag.CLIENT),
30+
) {
31+
override val width = 200.0
32+
override val height = 200.0
33+
34+
init {
35+
onRender {
36+
val enabled = ModuleRegistry.modules
37+
.filter { it.isEnabled }
38+
.filter { it.isVisible.value }
39+
drawString(enabled.joinToString("\n") { "${it.name} [${it.keybind.name}]" }, Vec2d.ZERO)
40+
}
41+
}
42+
}

common/src/main/kotlin/com/lambda/module/modules/client/RenderSettings.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ object RenderSettings : Module(
3131
private val page by setting("Page", Page.Font)
3232

3333
// Font
34-
val textFont by setting("Text Font", LambdaFont.FiraSansRegular)
35-
val emojiFont by setting("Emoji Font", LambdaEmoji.Twemoji)
34+
val textFont by setting("Text Font", LambdaFont.FiraSansRegular) { page == Page.Font }
35+
val emojiFont by setting("Emoji Font", LambdaEmoji.Twemoji) { page == Page.Font }
3636
val shadow by setting("Shadow", true) { page == Page.Font }
3737
val shadowBrightness by setting("Shadow Brightness", 0.35, 0.0..0.5, 0.01) { page == Page.Font && shadow }
3838
val shadowShift by setting("Shadow Shift", 1.0, 0.0..2.0, 0.05) { page == Page.Font && shadow }
@@ -43,8 +43,8 @@ object RenderSettings : Module(
4343
val sdfMax by setting("SDF Max", 1.0, 0.0..1.0, 0.01, visibility = { page == Page.Font })
4444

4545
// ESP
46-
val uploadsPerTick by setting("Uploads", 16, 1..256, 1, unit = " chunk/tick") { page == Page.ESP }
47-
val rebuildsPerTick by setting("Rebuilds", 64, 1..256, 1, unit = " chunk/tick") { page == Page.ESP }
46+
val uploadsPerTick by setting("Uploads", 16, 1..256, 1, unit = " chunks/tick") { page == Page.ESP }
47+
val rebuildsPerTick by setting("Rebuilds", 64, 1..256, 1, unit = " chunks/tick") { page == Page.ESP }
4848
val updateFrequency by setting("Update Frequency", 2, 1..10, 1, "Frequency of block updates", unit = " ticks") { page == Page.ESP }
4949
val outlineWidth by setting("Outline Width", 1.0, 0.1..5.0, 0.1, "Width of block outlines", unit = "px") { page == Page.ESP }
5050

0 commit comments

Comments
 (0)