Steal the purple imgui theme from FlowerMenu GTAV and add Inter font
parent
54589651d1
commit
ab0e18e2c8
|
@ -4,6 +4,7 @@ import codes.som.hibiscus.api.event.EventBus
|
||||||
import codes.som.hibiscus.events.KeyEvent
|
import codes.som.hibiscus.events.KeyEvent
|
||||||
import codes.som.hibiscus.gui.ImGuiScreen
|
import codes.som.hibiscus.gui.ImGuiScreen
|
||||||
import net.fabricmc.api.ModInitializer
|
import net.fabricmc.api.ModInitializer
|
||||||
|
import org.lwjgl.glfw.GLFW
|
||||||
import org.lwjgl.glfw.GLFW.GLFW_KEY_RIGHT_SHIFT
|
import org.lwjgl.glfw.GLFW.GLFW_KEY_RIGHT_SHIFT
|
||||||
|
|
||||||
@Suppress("UNUSED")
|
@Suppress("UNUSED")
|
||||||
|
@ -16,7 +17,7 @@ object HibiscusMod : ModInitializer {
|
||||||
|
|
||||||
override fun onInitialize() {
|
override fun onInitialize() {
|
||||||
bus.register { key: KeyEvent ->
|
bus.register { key: KeyEvent ->
|
||||||
if (key.key != GLFW_KEY_RIGHT_SHIFT)
|
if (key.key != GLFW_KEY_RIGHT_SHIFT || key.action != GLFW.GLFW_PRESS)
|
||||||
return@register
|
return@register
|
||||||
|
|
||||||
mc.setScreen(ImGuiScreen)
|
mc.setScreen(ImGuiScreen)
|
||||||
|
|
|
@ -17,6 +17,8 @@ object ImGuiScreen : Screen(Text.of("hacker_menu")) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
ImGui.createContext()
|
ImGui.createContext()
|
||||||
|
applyHibiscusImGuiTheme()
|
||||||
|
|
||||||
imGuiGlfw.init(mc.window.handle, true)
|
imGuiGlfw.init(mc.window.handle, true)
|
||||||
imGuiGl3.init()
|
imGuiGl3.init()
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
package codes.som.hibiscus.gui
|
||||||
|
|
||||||
|
import codes.som.hibiscus.HibiscusMod
|
||||||
|
import imgui.ImFontConfig
|
||||||
|
import imgui.ImGui
|
||||||
|
import imgui.ImGuiStyle
|
||||||
|
import imgui.ImVec4
|
||||||
|
import imgui.flag.ImGuiCol
|
||||||
|
|
||||||
|
fun applyHibiscusImGuiTheme() {
|
||||||
|
val style = ImGui.getStyle()
|
||||||
|
style.setWindowPadding(10f, 10f)
|
||||||
|
|
||||||
|
style.popupRounding = 0f
|
||||||
|
style.setFramePadding(8f, 4f)
|
||||||
|
style.setItemSpacing(10f, 8f)
|
||||||
|
style.setItemInnerSpacing(6f, 6f)
|
||||||
|
style.setTouchExtraPadding(0f, 0f)
|
||||||
|
style.indentSpacing = 21f
|
||||||
|
style.scrollbarSize = 15f
|
||||||
|
style.grabMinSize = 8f
|
||||||
|
style.windowBorderSize = 1f
|
||||||
|
style.childBorderSize = 0f
|
||||||
|
style.popupBorderSize = 1f
|
||||||
|
style.frameBorderSize = 0f
|
||||||
|
style.tabBorderSize = 0f
|
||||||
|
style.windowRounding = 0f
|
||||||
|
style.childRounding = 0f
|
||||||
|
style.frameRounding = 0f
|
||||||
|
style.scrollbarRounding = 0f
|
||||||
|
style.grabRounding = 0f
|
||||||
|
style.tabRounding = 0f
|
||||||
|
style.setWindowTitleAlign(0.5f, 0.5f)
|
||||||
|
style.setButtonTextAlign(0.5f, 0.5f)
|
||||||
|
style.setDisplaySafeAreaPadding(3f, 3f)
|
||||||
|
|
||||||
|
fun colHi(a: Float) = ImVec4(0.819f, 0.619f, 1.000f, a)
|
||||||
|
fun colMed(a: Float) = ImVec4(0.352f, 0.196f, 0.454f, a)
|
||||||
|
fun colLow(a: Float) = ImVec4(0.235f, 0.200f, 0.270f, a)
|
||||||
|
fun colBg(a: Float) = ImVec4(0.235f, 0.200f, 0.270f, a)
|
||||||
|
fun colText(a: Float) = ImVec4(1.000f, 1.000f, 1.000f, a)
|
||||||
|
|
||||||
|
fun ImGuiStyle.setColor(col: Int, vec: ImVec4) = this.setColor(col, vec.x, vec.y, vec.z, vec.w)
|
||||||
|
style.setColor(ImGuiCol.Text, colText(1.00f))
|
||||||
|
style.setColor(ImGuiCol.TextDisabled, colText(0.28f))
|
||||||
|
style.setColor(ImGuiCol.WindowBg, ImVec4(0.13f, 0.13f, 0.13f, 1.00f))
|
||||||
|
style.setColor(ImGuiCol.PopupBg, colBg(0.9f))
|
||||||
|
style.setColor(ImGuiCol.Border, ImVec4(0.31f, 0.31f, 1.00f, 0.00f))
|
||||||
|
style.setColor(ImGuiCol.BorderShadow, ImVec4(0.00f, 0.00f, 0.00f, 0.00f))
|
||||||
|
style.setColor(ImGuiCol.FrameBg, colBg(1.00f))
|
||||||
|
style.setColor(ImGuiCol.FrameBgHovered, colMed(0.78f))
|
||||||
|
style.setColor(ImGuiCol.FrameBgActive, colMed(1.00f))
|
||||||
|
style.setColor(ImGuiCol.TitleBg, colLow(1.00f))
|
||||||
|
style.setColor(ImGuiCol.TitleBgActive, colHi(1.00f))
|
||||||
|
style.setColor(ImGuiCol.TitleBgCollapsed, colBg(0.75f))
|
||||||
|
style.setColor(ImGuiCol.MenuBarBg, colBg(0.47f))
|
||||||
|
style.setColor(ImGuiCol.ScrollbarBg, colBg(1.00f))
|
||||||
|
style.setColor(ImGuiCol.ScrollbarGrab, ImVec4(0.09f, 0.15f, 0.16f, 1.00f))
|
||||||
|
style.setColor(ImGuiCol.ScrollbarGrabHovered, colMed(0.78f))
|
||||||
|
style.setColor(ImGuiCol.ScrollbarGrabActive, colMed(1.00f))
|
||||||
|
style.setColor(ImGuiCol.CheckMark, colHi(1.00f))
|
||||||
|
style.setColor(ImGuiCol.SliderGrab, ImVec4(0.63f, 0.47f, 0.83f, 0.14f))
|
||||||
|
style.setColor(ImGuiCol.SliderGrabActive, ImVec4(0.81f, 0.70f, 0.94f, 1.00f))
|
||||||
|
style.setColor(ImGuiCol.Button, ImVec4(0.63f, 0.47f, 0.83f, 0.14f))
|
||||||
|
style.setColor(ImGuiCol.ButtonHovered, colMed(0.86f))
|
||||||
|
style.setColor(ImGuiCol.ButtonActive, colMed(1.00f))
|
||||||
|
style.setColor(ImGuiCol.Header, colMed(0.76f))
|
||||||
|
style.setColor(ImGuiCol.HeaderHovered, colMed(0.86f))
|
||||||
|
style.setColor(ImGuiCol.HeaderActive, colHi(1.00f))
|
||||||
|
style.setColor(ImGuiCol.ResizeGrip, ImVec4(0.47f, 0.77f, 0.83f, 0.04f))
|
||||||
|
style.setColor(ImGuiCol.ResizeGripHovered, colMed(0.78f))
|
||||||
|
style.setColor(ImGuiCol.ResizeGripActive, colMed(1.00f))
|
||||||
|
style.setColor(ImGuiCol.PlotLines, colText(0.63f))
|
||||||
|
style.setColor(ImGuiCol.PlotLinesHovered, colMed(1.00f))
|
||||||
|
style.setColor(ImGuiCol.PlotHistogram, colText(0.63f))
|
||||||
|
style.setColor(ImGuiCol.PlotHistogramHovered, colMed(1.00f))
|
||||||
|
style.setColor(ImGuiCol.TextSelectedBg, colMed(0.43f))
|
||||||
|
style.setColor(ImGuiCol.ModalWindowDimBg, colBg(0.73f))
|
||||||
|
style.setColor(ImGuiCol.Tab, colLow(0.97f))
|
||||||
|
style.setColor(ImGuiCol.TabHovered, colHi(0.86f))
|
||||||
|
style.setColor(ImGuiCol.TabActive, colMed(0.97f))
|
||||||
|
style.setColor(ImGuiCol.TabUnfocused, colLow(0.86f))
|
||||||
|
style.setColor(ImGuiCol.TabUnfocusedActive, colMed(1.0f))
|
||||||
|
|
||||||
|
with(ImGui.getIO().fonts) {
|
||||||
|
val interTTF = HibiscusMod.javaClass.getResourceAsStream("/assets/inter/Inter-V.ttf")
|
||||||
|
?: error("Couldn't find Inter TTF in assets!")
|
||||||
|
addFontFromMemoryTTF(interTTF.readAllBytes(), 20f, ImFontConfig().apply {
|
||||||
|
setName("Inter")
|
||||||
|
})
|
||||||
|
|
||||||
|
addFontDefault(ImFontConfig().apply {
|
||||||
|
setName("Monospace")
|
||||||
|
})
|
||||||
|
|
||||||
|
build()
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Loading…
Reference in New Issue