Skip to content

Commit c3d4efa

Browse files
committed
polyui state v2 + GLRenderer fixes
1 parent 7ed6a9d commit c3d4efa

File tree

10 files changed

+305
-269
lines changed

10 files changed

+305
-269
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ kotlinx-coroutines = "1.10.2"
77
kotlinx-atomicfu = "0.29.0"
88
fabric-language-kotlin = "1.13.5+kotlin.2.2.10"
99
google-ksp = "2.2.10-2.0.2"
10-
polyui = "1.15.2"
10+
polyui = "2.0.4"
1111
annotations = "24.1.0"
1212
hypixel-modapi = "1.0.1"
1313
hypixel-data = "0.2.0" # Dep of hypixel-modapi

minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/UIManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ public UIManagerImpl() throws Throwable {
127127
tinyFD = Lwjgl3Manager.getIsolated(TinyFdApi.class, LWJGL_IMPL_PACKAGE + "TinyFdImpl");
128128
//#endif
129129

130-
renderer = new NVGRendererImpl(isGl3, nanoVg, nanoSvg, stb);
131-
// renderer = new GLRendererImpl(nanoSvg, stb);
130+
// renderer = new NVGRendererImpl(isGl3, nanoVg, nanoSvg, stb);
131+
renderer = new GLRendererImpl(nanoSvg, stb);
132132
} catch (Exception e) {
133133
throw new RuntimeException("Failed to get valid rendering implementation", e);
134134
}

minecraft/src/main/java/org/polyfrost/oneconfig/api/ui/v1/internal/wrappers/PolyUIScreen.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,11 @@ public void onRender(@NotNull OmniRenderingContext ctx, int mouseX, int mouseY,
136136
//#else
137137
glGetInteger(GL_VIEWPORT, VIEWPORT);
138138
//#endif
139-
int w = (int) polyUI.getMaster().getWidth();
140-
int h = (int) polyUI.getMaster().getHeight();
141-
int x = Platform.screen().windowWidth() / 2 - w / 2;
142-
int y = Platform.screen().windowHeight() / 2 - h / 2;
139+
float factor = Platform.screen().pixelRatio();
140+
int w = (int) (polyUI.getMaster().getWidth() * factor);
141+
int h = (int) (polyUI.getMaster().getHeight() * factor);
142+
int x = Platform.screen().viewportWidth() / 2 - w / 2;
143+
int y = Platform.screen().viewportHeight() / 2 - h / 2;
143144
glViewport(x, y, w, h);
144145
polyUI.render();
145146
glViewport(VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get(), VIEWPORT.get());

0 commit comments

Comments
 (0)