Skip to content

Commit

Permalink
fix UI not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
nextdayy committed Nov 4, 2024
1 parent 79048ec commit d027d34
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ kotlin = "2.0.20"
kotlinx-coroutines = "1.8.1"
kotlinx-atomicfu = "0.24.0"
fabric-language-kotlin = "1.12.2+kotlin.2.0.20"
polyui = "1.7.1"
polyui = "1.7.11"
annotations = "24.1.0"
hypixel-modapi = "1.0"
hypixel-data = "0.1.2" # Dep of hypixel-modapi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import org.polyfrost.polyui.data.Cursor
import org.polyfrost.polyui.data.PolyImage
import org.polyfrost.polyui.unit.Align
import org.polyfrost.polyui.unit.Vec2
import org.polyfrost.polyui.unit.by
import org.polyfrost.polyui.unit.seconds
import org.polyfrost.polyui.utils.image

Expand All @@ -65,7 +64,7 @@ object OneConfigUI {

@JvmOverloads
fun open(initialScreen: Component = ModsPage(ConfigManager.active().trees())) {
val builder = (OCPolyUIBuilder.create().blurs() as OCPolyUIBuilder).atResolution(1920f, 1080f)
val builder = OCPolyUIBuilder.create().blurs().atResolution(1920f, 1080f)
.backgroundColor(rgba(21, 21, 21)).size(1400f, 700f) as OCPolyUIBuilder
builder.translatorDelegate("assets/oneconfig")
builder.onClose { _ ->
Expand All @@ -90,24 +89,23 @@ object OneConfigUI {
SidebarButton(
"assets/oneconfig/ico/profiles.svg".image(),
"oneconfig.profiles",
).addHoverInfo(Text("this feature is experimental and is coming soon!")),
SidebarButton("assets/oneconfig/ico/keyboard.svg".image(), "oneconfig.keybinds"),
).disable().addHoverInfo(Text("this feature is experimental and is coming soon!")),
SidebarButton("assets/oneconfig/ico/keyboard.svg".image(), "oneconfig.keybinds").disable(),
Text("oneconfig.sidebar.title.personal", fontSize = 11f).setPalette { text.secondary }.padded(0f, 12f, 0f, 0f),
SidebarButton("assets/oneconfig/ico/paintbrush.svg".image(), "oneconfig.themes", label("oneconfig.soon")).onClick {
openPage(ThemesPage(), "oneconfig.themes")
},
}.disable(),
SidebarButton("assets/oneconfig/ico/cog.svg".image(), "oneconfig.preferences"),
Text("oneconfig.sidebar.title.extra", fontSize = 11f).setPalette { text.secondary }.padded(0f, 12f, 0f, 0f),
SidebarButton("assets/oneconfig/ico/refresh.svg".image(), "oneconfig.changelog"),
SidebarButton(
"assets/oneconfig/ico/refresh.svg".image(),
"oneconfig.changelog",
),
SidebarButton(
"assets/oneconfig/ico/text.svg".image(),
"oneconfig.feedback",
label("oneconfig.beta"),
"assets/oneconfig/ico/text.svg".image(), "oneconfig.feedback"
).onClick { openPage(FeedbackPage(), "oneconfig.feedback") },
SidebarButton0("assets/oneconfig/ico/hud.svg".image(), "oneconfig.edithud").onClick {
SidebarButton0(
"assets/oneconfig/ico/hud.svg".image(),
"oneconfig.edithud",
label("oneconfig.beta")
).onClick {
Platform.screen().display(HudManager.getWithEditor())
}.padded(0f, 200f, 0f, 0f),
size = Vec2(273f, 700f),
Expand All @@ -116,7 +114,8 @@ object OneConfigUI {
Group(
Group(
Group(
Image("assets/oneconfig/ico/left-arrow.svg".image()).named("Back").disable(), Image("assets/oneconfig/ico/right-arrow.svg".image()).named("Forward").disable(),
Image("assets/oneconfig/ico/left-arrow.svg".image()).named("Back").disable(),
Image("assets/oneconfig/ico/right-arrow.svg".image()).named("Forward").disable(),
Text(
"oneconfig.mods",
fontSize = 24f,
Expand Down Expand Up @@ -147,7 +146,7 @@ object OneConfigUI {
if (search.children?.size == 0) search.children?.add(searchNoneFound)
if (ui[1][1] !== search) openPage(search, "oneconfig.search")
search.recalculate()
} else if(ui[1][1] === search) {
} else if (ui[1][1] === search) {
openPage(ModsPage(ConfigManager.active().trees()), "oneconfig.mods")
}
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fun ModsPage(trees: Collection<Tree>): Drawable {
}.toTypedArray(),
visibleSize = Vec2(1130f, 635f),
alignment = Align(cross = Align.Cross.Start, pad = Vec2(18f, 18f)),
).namedId("ModsPage")
).makeRearrangeableGrid().namedId("ModsPage")
}

fun ThemesPage(): Drawable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.polyfrost.oneconfig.api.hud.v1.HudManager;
import org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils;
import org.polyfrost.oneconfig.api.platform.v1.Platform;
import org.polyfrost.oneconfig.api.ui.v1.UIManager;
import org.polyfrost.oneconfig.api.ui.v1.internal.BlurHandler;
import org.polyfrost.oneconfig.api.ui.v1.keybind.OCKeybindHelper;
import org.polyfrost.oneconfig.internal.ui.OneConfigUI;
Expand Down Expand Up @@ -115,7 +114,8 @@ private static void preload() {
Class.forName(PolyUI.class.getName());
Class.forName(Drawable.class.getName());
Class.forName(Translator.class.getName());
UIManager.INSTANCE.getRenderer();
// todo: fix for fabric loaders as fails due to running too early
// UIManager.INSTANCE.getRenderer();
} catch (Exception e) {
throw new IllegalStateException("Failed to preload necessary PolyUI classes", e);
}
Expand Down

0 comments on commit d027d34

Please sign in to comment.