Fix pointer lock
This commit is contained in:
parent
de1a5c024f
commit
7095e0be52
|
@ -309,6 +309,11 @@ public class EaglerAdapterImpl2 {
|
|||
forceMouseGrabbed();
|
||||
}
|
||||
});
|
||||
win.addEventListener("pointerlockchange", new EventListener<MouseEvent>() {
|
||||
public void handleEvent(MouseEvent evt) {
|
||||
lostFocus = true;
|
||||
}
|
||||
});
|
||||
onBeforeCloseRegister();
|
||||
|
||||
if(!config.isNull("dataBaseName")) {
|
||||
|
@ -354,6 +359,7 @@ public class EaglerAdapterImpl2 {
|
|||
public static String forcedServer = null;
|
||||
public static String dataBaseName = null;
|
||||
public static boolean joinServerOnLaunch = false;
|
||||
private static boolean lostFocus = false;
|
||||
|
||||
public static final void destroyContext() {
|
||||
|
||||
|
@ -1173,6 +1179,10 @@ public class EaglerAdapterImpl2 {
|
|||
private static boolean pointerLockFlag = false;
|
||||
|
||||
public static final boolean isFocused() {
|
||||
if(lostFocus) {
|
||||
lostFocus = false;
|
||||
return false;
|
||||
}
|
||||
boolean yee = isPointerLocked();
|
||||
boolean dee = pointerLockFlag;
|
||||
pointerLockFlag = yee;
|
||||
|
|
|
@ -392,10 +392,6 @@ public class Minecraft implements Runnable {
|
|||
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
|
||||
}
|
||||
|
||||
if(!GL11.isFocused()) {
|
||||
Thread.sleep(10L);
|
||||
}
|
||||
|
||||
if(this.gameSettings.showDebugInfo) {
|
||||
this.displayDebugInfo(var24);
|
||||
} else {
|
||||
|
@ -554,7 +550,7 @@ public class Minecraft implements Runnable {
|
|||
}
|
||||
|
||||
public void setIngameFocus() {
|
||||
if(GL11.isFocused()) {
|
||||
//if(GL11.isFocused()) {
|
||||
if(!this.inGameHasFocus) {
|
||||
this.inGameHasFocus = true;
|
||||
this.mouseHelper.grabMouseCursor();
|
||||
|
@ -562,7 +558,7 @@ public class Minecraft implements Runnable {
|
|||
this.leftClickCounter = 10000;
|
||||
this.mouseTicksRan = this.ticksRan + 10000;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
public void setIngameNotInFocus() {
|
||||
|
|
|
@ -329,9 +329,7 @@ public class EntityRenderer {
|
|||
|
||||
public void updateCameraAndRender(float var1) {
|
||||
if(!GL11.isFocused()) {
|
||||
if(System.currentTimeMillis() - this.prevFrameTime > 500L) {
|
||||
this.mc.displayInGameMenu();
|
||||
}
|
||||
} else {
|
||||
this.prevFrameTime = System.currentTimeMillis();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user