Skip to content

Commit bd9357e

Browse files
committed
cleanup hud module base settings
1 parent 01dbb30 commit bd9357e

File tree

4 files changed

+270
-273
lines changed

4 files changed

+270
-273
lines changed

src/main/kotlin/com/lambda/gui/components/HudGuiLayout.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import com.lambda.event.listener.SafeListener.Companion.listen
2525
import com.lambda.gui.components.SettingsWidget.buildConfigSettingsContext
2626
import com.lambda.gui.dsl.ImGuiBuilder
2727
import com.lambda.gui.dsl.ImGuiBuilder.buildLayout
28-
import com.lambda.gui.snap.Guide
2928
import com.lambda.gui.snap.RectF
3029
import com.lambda.gui.snap.SnapManager
3130
import com.lambda.gui.snap.SnapManager.drawDragGrid
@@ -42,7 +41,6 @@ import imgui.flag.ImGuiStyleVar
4241
import imgui.flag.ImGuiWindowFlags
4342
import java.awt.Color
4443
import kotlin.math.PI
45-
import kotlin.math.max
4644

4745
object HudGuiLayout : Loadable, Configurable(HudConfig) {
4846
override val name = "HUD"
@@ -146,7 +144,7 @@ object HudGuiLayout : Loadable, Configurable(HudConfig) {
146144
ImGui.setNextWindowPos(override.first, override.second)
147145
}
148146

149-
val bg = hud.backgroundColor
147+
val bg = hud.backgroundColor.value
150148
val hasBg = bg.alpha > 0
151149
val baseFlags = if (hasBg) {
152150
DEFAULT_HUD_FLAGS and ImGuiWindowFlags.NoBackground.inv()
@@ -160,12 +158,9 @@ object HudGuiLayout : Loadable, Configurable(HudConfig) {
160158
val packed = ImColor.rgba(bg.red, bg.green, bg.blue, bg.alpha)
161159
ImGui.pushStyleColor(imgui.flag.ImGuiCol.WindowBg, packed)
162160
true
163-
} else {
164-
false
165-
}
161+
} else false
166162

167-
val outlineWidth = if (hud.outline) hud.outlineWidth else 0f
168-
withStyleVar(ImGuiStyleVar.WindowBorderSize, outlineWidth) {
163+
withStyleVar(ImGuiStyleVar.WindowBorderSize, 0f) {
169164
window("##${hud.name}", flags = hudFlags) {
170165
if (ClickGuiLayout.open && !isLocked && activeDragHudName == null && mousePressedThisFrameGlobal && ImGui.isWindowHovered()) {
171166
val mx = io.mousePos.x

src/main/kotlin/com/lambda/gui/components/SettingsWidget.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.lambda.config.Setting
2424
import com.lambda.config.UserAutomationConfig
2525
import com.lambda.config.configurations.UserAutomationConfigs
2626
import com.lambda.gui.dsl.ImGuiBuilder
27+
import com.lambda.module.HudModule
2728
import com.lambda.module.Module
2829
import com.lambda.util.NamedEnum
2930
import imgui.ImGui
@@ -41,6 +42,9 @@ object SettingsWidget {
4142
with(config.disableOnReleaseSetting) { buildLayout() }
4243
with(config.drawSetting) { buildLayout() }
4344
}
45+
if (config is HudModule) {
46+
with(config.backgroundColor) { buildLayout() }
47+
}
4448
smallButton("Reset") {
4549
config.settings.forEach { it.reset(silent = true) }
4650
}
@@ -76,7 +80,8 @@ object SettingsWidget {
7680
}
7781
val toIgnoreSettings =
7882
when (config) {
79-
is Module -> setOf(config.keybindSetting, config.disableOnReleaseSetting, config.drawSetting)
83+
is HudModule -> setOf(config.backgroundColor)
84+
is Module -> setOf(config.keybindSetting, config.disableOnReleaseSetting, config.drawSetting)
8085
is UserAutomationConfig -> setOf(config.linkedModules)
8186
else -> emptySet()
8287
}

0 commit comments

Comments
 (0)