Skip to content

Commit 657ecbd

Browse files
committed
some "fixes"
1 parent d841a4e commit 657ecbd

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

minecraft/src/main/java/org/polyfrost/oneconfig/api/platform/v1/internal/ScreenPlatformImpl.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public int windowWidth() {
6060
//#if MC>=11502
6161
//$$ return Minecraft.getInstance().getWindow().getWidth();
6262
//#else
63-
return (int) (Minecraft.getMinecraft().displayWidth / org.lwjgl.opengl.Display.getPixelScaleFactor());
63+
return Minecraft.getMinecraft().displayWidth; //TODO uh... either this is the "fix" that breaks input or this is good
6464
//#endif
6565
}
6666

@@ -69,7 +69,7 @@ public int windowHeight() {
6969
//#if MC>=11502
7070
//$$ return Minecraft.getInstance().getWindow().getHeight();
7171
//#else
72-
return (int) (Minecraft.getMinecraft().displayHeight / org.lwjgl.opengl.Display.getPixelScaleFactor());
72+
return Minecraft.getMinecraft().displayHeight; // todo same here
7373
//#endif
7474
}
7575

@@ -84,6 +84,15 @@ public OmniMatrixStack getSmuggledMatrixStack() {
8484
return smuggled;
8585
}
8686

87+
@Override
88+
public float pixelRatio() {
89+
//#if MC>=11502
90+
//$$ return (float) windowWidth() / viewportWidth();
91+
//#else
92+
return org.lwjgl.opengl.Display.getPixelScaleFactor();
93+
//#endif
94+
}
95+
8796
@Override
8897
public void display(@Nullable Object screen, int ticks) {
8998
if (ticks < 1) Minecraft.getMinecraft().displayGuiScreen((GuiScreen) screen);

minecraft/src/main/java/org/polyfrost/oneconfig/internal/mixin/hidpi/Mixin_FixDisplaySizeHiDPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public abstract class Mixin_FixDisplaySizeHiDPI {
3232
@Unique
3333
private static final Logger oneconfig$HIDPI_LOGGER = LogManager.getLogger("OneConfig/HiDPI");
3434

35-
@WrapOperation(method = "checkWindowResize", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;wasResized()Z"))
35+
@WrapOperation(method = "checkWindowResize", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;wasResized()Z", remap = false), remap = true)
3636
private boolean hiDpiFixWasResized(Operation<Boolean> original) {
3737
// If the display scale factor is not 1, we assume that the window has been resized
3838
// to account for HiDPI scaling.

modules/utils/src/main/java/org/polyfrost/oneconfig/api/platform/v1/ScreenPlatform.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ public interface ScreenPlatform {
5555
@ApiStatus.Obsolete
5656
OmniMatrixStack getSmuggledMatrixStack();
5757

58-
default float pixelRatio() {
59-
return (float) windowWidth() / viewportWidth();
60-
}
58+
float pixelRatio();
6159

6260
void display(@Nullable Object screen, int ticks);
6361

0 commit comments

Comments
 (0)