Skip to content

Commit 803e630

Browse files
committed
Show units for numeric settings
1 parent 645bc2b commit 803e630

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
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/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)