Gui styling

main
Charlotte Som 2022-02-03 20:47:25 +00:00
parent ceac1fda7a
commit ca456f0689
3 changed files with 28 additions and 5 deletions

View File

@ -23,13 +23,13 @@ class Flight : Feature("Flight", FeatureCategory.MOVEMENT) {
player.abilities.flying = true player.abilities.flying = true
} }
val interceptServerboundAbilityPackets by values.bool("Intercept Serverbound Ability Packets", true) val spoofAbilityPackets by values.bool("Spoof Outgoing Ability Packets", true)
val vanillaKickBypass by values.bool("Vanilla Kick Bypass", false) val vanillaKickBypass by values.bool("Vanilla Kick Bypass", false)
on { event: SendPacketEvent -> on { event: SendPacketEvent ->
val (packet) = event val (packet) = event
if (!interceptServerboundAbilityPackets) if (!spoofAbilityPackets)
return@on return@on
if (packet is UpdatePlayerAbilitiesC2SPacket) { if (packet is UpdatePlayerAbilitiesC2SPacket) {

View File

@ -51,7 +51,7 @@ fun applyHibiscusImGuiTheme() {
style.setColor(ImGuiCol.FrameBgHovered, colMed(0.78f)) style.setColor(ImGuiCol.FrameBgHovered, colMed(0.78f))
style.setColor(ImGuiCol.FrameBgActive, colMed(1.00f)) style.setColor(ImGuiCol.FrameBgActive, colMed(1.00f))
style.setColor(ImGuiCol.TitleBg, colLow(1.00f)) style.setColor(ImGuiCol.TitleBg, colLow(1.00f))
style.setColor(ImGuiCol.TitleBgActive, colHi(1.00f)) style.setColor(ImGuiCol.TitleBgActive, colMed(1.00f))
style.setColor(ImGuiCol.TitleBgCollapsed, colBg(0.75f)) style.setColor(ImGuiCol.TitleBgCollapsed, colBg(0.75f))
style.setColor(ImGuiCol.MenuBarBg, colBg(0.47f)) style.setColor(ImGuiCol.MenuBarBg, colBg(0.47f))
style.setColor(ImGuiCol.ScrollbarBg, colBg(1.00f)) style.setColor(ImGuiCol.ScrollbarBg, colBg(1.00f))

View File

@ -4,6 +4,7 @@ import codes.som.hibiscus.HibiscusMod
import codes.som.hibiscus.api.feature.Feature import codes.som.hibiscus.api.feature.Feature
import codes.som.hibiscus.api.feature.FeatureCategory import codes.som.hibiscus.api.feature.FeatureCategory
import imgui.ImGui import imgui.ImGui
import imgui.flag.ImGuiCol
import imgui.flag.ImGuiCond.FirstUseEver import imgui.flag.ImGuiCond.FirstUseEver
import imgui.flag.ImGuiWindowFlags import imgui.flag.ImGuiWindowFlags
import imgui.flag.ImGuiWindowFlags.AlwaysVerticalScrollbar import imgui.flag.ImGuiWindowFlags.AlwaysVerticalScrollbar
@ -14,6 +15,7 @@ object ModuleControlsUI {
private fun categoryPanel(category: FeatureCategory, initialX: Float, initialY: Float) { private fun categoryPanel(category: FeatureCategory, initialX: Float, initialY: Float) {
ImGui.setNextWindowPos(initialX, initialY, FirstUseEver) ImGui.setNextWindowPos(initialX, initialY, FirstUseEver)
ImGui.setNextWindowCollapsed(true, FirstUseEver) ImGui.setNextWindowCollapsed(true, FirstUseEver)
ImGui.setNextWindowSize(300f, 0f, FirstUseEver)
ImGui.begin(category.humanName, AlwaysVerticalScrollbar) ImGui.begin(category.humanName, AlwaysVerticalScrollbar)
@ -25,12 +27,33 @@ object ModuleControlsUI {
} }
private fun featureControls(feature: Feature) { private fun featureControls(feature: Feature) {
ImGuiKt.checkbox(feature.name, feature::enabled) if (feature.values.exist()) {
ImGui.columns(2, "Features Columns", false)
ImGui.setColumnWidth(0, ImGui.getWindowContentRegionMaxX() - ImGui.getWindowContentRegionMinX() - 24)
}
if (feature.enabled) {
ImGui.pushStyleColor(ImGuiCol.Button, 0.819f, 0.619f, 1.000f, 0.8f)
ImGui.pushStyleColor(ImGuiCol.ButtonHovered, 0.819f, 0.619f, 1.000f, 0.95f)
ImGui.pushStyleColor(ImGuiCol.ButtonActive, 0.819f, 0.619f, 1.000f, 1f)
} else {
ImGui.pushStyleColor(ImGuiCol.Button, 0.63f, 0.47f, 0.83f, 0.14f)
ImGui.pushStyleColor(ImGuiCol.ButtonHovered, 0.352f, 0.196f, 0.454f, 0.86f)
ImGui.pushStyleColor(ImGuiCol.ButtonActive, 0.352f, 0.196f, 0.454f, 1f)
}
if (ImGui.button(feature.name, -1f, 0f)) {
feature.enabled = !feature.enabled
}
ImGui.popStyleColor()
ImGui.popStyleColor()
ImGui.popStyleColor()
if (feature.values.exist()) { if (feature.values.exist()) {
val showValueWindow = moduleValueWindows.getOrPut(feature) { booleanArrayOf(false) } val showValueWindow = moduleValueWindows.getOrPut(feature) { booleanArrayOf(false) }
ImGui.sameLine(ImGui.getWindowContentRegionMaxX() - ImGui.getWindowContentRegionMinX() - 10) ImGui.nextColumn()
if (ImGui.radioButton("##${feature.name} values", showValueWindow[0])) { if (ImGui.radioButton("##${feature.name} values", showValueWindow[0])) {
showValueWindow[0] = !showValueWindow[0] showValueWindow[0] = !showValueWindow[0]
} }