mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-06-27 18:38:14 -05:00
Update #37 - Touch support without userscript, many other feats
This commit is contained in:
@ -20,6 +20,8 @@ import net.lax1dude.eaglercraft.v1_8.internal.PlatformInput;
|
||||
public class Display {
|
||||
|
||||
private static long lastSwap = 0l;
|
||||
private static long lastDPIUpdate = -250l;
|
||||
private static float cacheDPI = 1.0f;
|
||||
|
||||
public static int getWidth() {
|
||||
return PlatformInput.getWindowWidth();
|
||||
@ -29,6 +31,22 @@ public class Display {
|
||||
return PlatformInput.getWindowHeight();
|
||||
}
|
||||
|
||||
public static int getVisualViewportX() {
|
||||
return PlatformInput.getVisualViewportX();
|
||||
}
|
||||
|
||||
public static int getVisualViewportY() {
|
||||
return PlatformInput.getVisualViewportY();
|
||||
}
|
||||
|
||||
public static int getVisualViewportW() {
|
||||
return PlatformInput.getVisualViewportW();
|
||||
}
|
||||
|
||||
public static int getVisualViewportH() {
|
||||
return PlatformInput.getVisualViewportH();
|
||||
}
|
||||
|
||||
public static boolean isActive() {
|
||||
return PlatformInput.getWindowFocused();
|
||||
}
|
||||
@ -61,24 +79,32 @@ public class Display {
|
||||
boolean limitFPS = limitFramerate > 0 && limitFramerate < 1000;
|
||||
|
||||
if(limitFPS) {
|
||||
long millis = System.currentTimeMillis();
|
||||
long millis = EagRuntime.steadyTimeMillis();
|
||||
long frameMillis = (1000l / limitFramerate) - (millis - lastSwap);
|
||||
if(frameMillis > 0l) {
|
||||
EagUtils.sleep(frameMillis);
|
||||
}
|
||||
}
|
||||
|
||||
lastSwap = System.currentTimeMillis();
|
||||
lastSwap = EagRuntime.steadyTimeMillis();
|
||||
}
|
||||
|
||||
public static boolean contextLost() {
|
||||
return PlatformInput.contextLost();
|
||||
}
|
||||
|
||||
|
||||
public static boolean wasResized() {
|
||||
return PlatformInput.wasResized();
|
||||
}
|
||||
|
||||
public static boolean wasVisualViewportResized() {
|
||||
return PlatformInput.wasVisualViewportResized();
|
||||
}
|
||||
|
||||
public static boolean supportsFullscreen() {
|
||||
return PlatformInput.supportsFullscreen();
|
||||
}
|
||||
|
||||
public static boolean isFullscreen() {
|
||||
return PlatformInput.isFullscreen();
|
||||
}
|
||||
@ -87,4 +113,13 @@ public class Display {
|
||||
PlatformInput.toggleFullscreen();
|
||||
}
|
||||
|
||||
public static float getDPI() {
|
||||
long millis = EagRuntime.steadyTimeMillis();
|
||||
if(millis - lastDPIUpdate > 250l) {
|
||||
lastDPIUpdate = millis;
|
||||
cacheDPI = PlatformInput.getDPI();
|
||||
}
|
||||
return cacheDPI;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user