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