mobile support part 1

This commit is contained in:
kone 2023-04-18 23:07:02 -04:00
parent ac507f39a7
commit 664403884d
2 changed files with 6 additions and 4 deletions

View File

@ -515,7 +515,7 @@ public class PlatformInput {
pointerLockFlag = grab;
mouseGrabTimer = t;
if (grab) {
canvas.requestPointerLock();
if (!PlatformRuntime.isMobile) canvas.requestPointerLock();
if (mouseUngrabTimeout != -1) Window.clearTimeout(mouseUngrabTimeout);
mouseUngrabTimeout = -1;
if (t - mouseUngrabTimer < 3000l) {
@ -524,7 +524,7 @@ public class PlatformInput {
new TimerHandler() {
@Override
public void onTimer() {
canvas.requestPointerLock();
if (!PlatformRuntime.isMobile) canvas.requestPointerLock();
}
},
3100 - (int) (t - mouseUngrabTimer)
@ -533,7 +533,7 @@ public class PlatformInput {
} else {
if (mouseUngrabTimeout != -1) Window.clearTimeout(mouseUngrabTimeout);
mouseUngrabTimeout = -1;
Window.current().getDocument().exitPointerLock();
if (!PlatformRuntime.isMobile) Window.current().getDocument().exitPointerLock();
}
mouseDX = 0.0D;
mouseDY = 0.0D;

View File

@ -72,6 +72,7 @@ public class PlatformRuntime {
public static HTMLElement parent = null;
public static HTMLCanvasElement canvas = null;
public static WebGL2RenderingContext webgl = null;
public static boolean isMobile = false;
static WebGLFramebuffer mainFramebuffer = null;
@ -119,7 +120,8 @@ public class PlatformRuntime {
try {
doc.exitPointerLock();
} catch (Throwable t) {
throw new PlatformIncompatibleException("Mouse cursor lock is not available on this device!");
isMobile = true;
//throw new PlatformIncompatibleException("Mouse cursor lock is not available on this device!");
}
logger.info("Creating WebGL context");