Skip to content

Commit

Permalink
Merge pull request #130 from Lyzev/129-suggestion-initial-size-and-po…
Browse files Browse the repository at this point in the history
…s-for-feature-screen-panels

added initial size and pos
  • Loading branch information
Lyzev authored Jun 8, 2024
2 parents 27733bc + c15b345 commit 07c4c71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import dev.lyzev.api.imgui.render.ImGuiRenderable
import dev.lyzev.api.setting.SettingInitializer
import dev.lyzev.schizoid.Schizoid
import imgui.ImGui.*
import imgui.flag.ImGuiCond
import imgui.flag.ImGuiStyleVar
import imgui.type.ImString
import me.xdrop.fuzzywuzzy.FuzzySearch
Expand All @@ -23,6 +24,10 @@ class ImGuiRenderableConfigManager : ImGuiRenderable {
override fun render() {
pushID("##configmanger")
OPEN_SANS_BOLD.begin()
val width = (Schizoid.mc.window.framebufferWidth - 620) / 3f
val height = (Schizoid.mc.window.framebufferHeight - 620) / 3f
setNextWindowSize(width, height, ImGuiCond.FirstUseEver)
setNextWindowPos(300 + 2 * (width + 10), 300 + 2 * (height + 10), ImGuiCond.FirstUseEver)
if (begin("\"CONFIG\"")) {
OPEN_SANS_REGULAR.begin()
val style = getStyle()
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/dev/lyzev/schizoid/feature/Feature.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import dev.lyzev.api.settings.SettingManager
import dev.lyzev.schizoid.Schizoid
import dev.lyzev.schizoid.feature.features.gui.guis.ImGuiScreenFeature
import imgui.ImGui.*
import imgui.flag.ImGuiCond
import net.minecraft.client.MinecraftClient
import net.minecraft.text.Text

Expand Down Expand Up @@ -133,6 +134,10 @@ interface IFeature : ImGuiRenderable {
OPEN_SANS_BOLD.begin()
if (ImGuiScreenFeature.search.result != null && ImGuiScreenFeature.search.result!!.category == this)
setNextWindowFocus()
val width = (Schizoid.mc.window.framebufferWidth - 620) / 3f
val height = (Schizoid.mc.window.framebufferHeight - 620) / 3f
setNextWindowSize(width, height, ImGuiCond.FirstUseEver)
setNextWindowPos(300 + (ordinal % 3) * (width + 10), 300 + (ordinal / 3) * (height + 10), ImGuiCond.FirstUseEver)
if (begin("\"$name\"")) {
OPEN_SANS_REGULAR.begin()
FeatureManager[this].forEach(IFeature::render)
Expand Down

0 comments on commit 07c4c71

Please sign in to comment.