mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-06-27 18:38:14 -05:00
Update #45 - Fixed various issues with the client
This commit is contained in:
@ -19,7 +19,6 @@ 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;
|
||||
|
||||
@ -79,41 +78,6 @@ public class Display {
|
||||
PlatformInput.update(limitFramerate);
|
||||
}
|
||||
|
||||
private static final long[] defaultSyncPtr = new long[1];
|
||||
|
||||
public static void sync(int limitFramerate) {
|
||||
sync(limitFramerate, defaultSyncPtr);
|
||||
}
|
||||
|
||||
public static boolean sync(int limitFramerate, long[] timerPtr) {
|
||||
boolean limitFPS = limitFramerate > 0 && limitFramerate < 1000;
|
||||
boolean blocked = false;
|
||||
|
||||
if(limitFPS) {
|
||||
if(timerPtr[0] == 0l) {
|
||||
timerPtr[0] = EagRuntime.steadyTimeMillis();
|
||||
}else {
|
||||
long millis = EagRuntime.steadyTimeMillis();
|
||||
long frameMillis = (1000l / limitFramerate);
|
||||
long frameTime = millis - timerPtr[0];
|
||||
if(frameTime > 2000l || frameTime < 0l) {
|
||||
frameTime = frameMillis;
|
||||
timerPtr[0] = millis;
|
||||
}else {
|
||||
timerPtr[0] += frameMillis;
|
||||
}
|
||||
if(frameTime >= 0l && frameTime < frameMillis) {
|
||||
EagUtils.sleep(frameMillis - frameTime);
|
||||
blocked = true;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
timerPtr[0] = 0l;
|
||||
}
|
||||
|
||||
return blocked;
|
||||
}
|
||||
|
||||
public static boolean contextLost() {
|
||||
return PlatformInput.contextLost();
|
||||
}
|
||||
|
Reference in New Issue
Block a user