made F+6 hide the coords, improved framebuffer swap system
This commit is contained in:
parent
fb890d77f5
commit
5abca8310b
|
@ -1393,7 +1393,7 @@ public class EaglerAdapterImpl2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String getUserAgent() {
|
public static final String getUserAgent() {
|
||||||
return System.getProperty("os.name");
|
return "Desktop/" + System.getProperty("os.name");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String getClipboard() {
|
public static final String getClipboard() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ public class ConfigConstants {
|
||||||
|
|
||||||
public static boolean profanity = false;
|
public static boolean profanity = false;
|
||||||
|
|
||||||
public static final String version = "22w19a";
|
public static final String version = "22w20a";
|
||||||
public static final String mainMenuString = "eaglercraft " + version;
|
public static final String mainMenuString = "eaglercraft " + version;
|
||||||
|
|
||||||
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";
|
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";
|
||||||
|
|
47
src/main/java/net/lax1dude/eaglercraft/EnumBrowser.java
Normal file
47
src/main/java/net/lax1dude/eaglercraft/EnumBrowser.java
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
package net.lax1dude.eaglercraft;
|
||||||
|
|
||||||
|
public enum EnumBrowser {
|
||||||
|
|
||||||
|
DESKTOP("Desktop"), CHROME("Chrome"), EDGE("Edge"), IE("IE"), FIREFOX("Firefox"), SAFARI("Safari"), OPERA("Opera"), WEBKIT("WebKit"), GECKO("Gecko"), UNKNOWN("Unknown");
|
||||||
|
|
||||||
|
public final String name;
|
||||||
|
|
||||||
|
private EnumBrowser(String string) {
|
||||||
|
this.name = string;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static EnumBrowser identifiedBrowser = null;
|
||||||
|
|
||||||
|
public static EnumBrowser getBrowser() {
|
||||||
|
if(identifiedBrowser == null) {
|
||||||
|
String ua = " " + EaglerAdapter.getUserAgent().toLowerCase();
|
||||||
|
if(ua.contains(" edg/")) {
|
||||||
|
identifiedBrowser = EDGE;
|
||||||
|
}else if(ua.contains(" opr/")) {
|
||||||
|
identifiedBrowser = OPERA;
|
||||||
|
}else if(ua.contains(" chrome/")) {
|
||||||
|
identifiedBrowser = CHROME;
|
||||||
|
}else if(ua.contains(" firefox/")) {
|
||||||
|
identifiedBrowser = FIREFOX;
|
||||||
|
}else if(ua.contains(" safari/")) {
|
||||||
|
identifiedBrowser = SAFARI;
|
||||||
|
}else if(ua.contains(" trident/") || ua.contains(" msie")) {
|
||||||
|
identifiedBrowser = IE;
|
||||||
|
}else if(ua.contains(" webkit/")) {
|
||||||
|
identifiedBrowser = WEBKIT;
|
||||||
|
}else if(ua.contains(" gecko/")) {
|
||||||
|
identifiedBrowser = GECKO;
|
||||||
|
}else if(ua.contains(" desktop/")) {
|
||||||
|
identifiedBrowser = DESKTOP;
|
||||||
|
}else {
|
||||||
|
identifiedBrowser = UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return identifiedBrowser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -157,6 +157,8 @@ public class Minecraft implements Runnable {
|
||||||
int fpsCounter = 0;
|
int fpsCounter = 0;
|
||||||
long prevFrameTime = -1L;
|
long prevFrameTime = -1L;
|
||||||
|
|
||||||
|
public int showHints = 140;
|
||||||
|
|
||||||
long secondTimer = 0l;
|
long secondTimer = 0l;
|
||||||
|
|
||||||
private HashSet<String> shownPlayerMessages = new HashSet();
|
private HashSet<String> shownPlayerMessages = new HashSet();
|
||||||
|
@ -1234,6 +1236,11 @@ public class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EaglerAdapter.getEventKey() == 7 && this.gameSettings.keyBindFunction.pressed) {
|
||||||
|
this.gameSettings.showCoordinates = !this.gameSettings.showCoordinates;
|
||||||
|
this.gameSettings.saveOptions();
|
||||||
|
}
|
||||||
|
|
||||||
if (EaglerAdapter.getEventKey() == 9 && this.gameSettings.keyBindFunction.pressed) {
|
if (EaglerAdapter.getEventKey() == 9 && this.gameSettings.keyBindFunction.pressed) {
|
||||||
this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera;
|
this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera;
|
||||||
}
|
}
|
||||||
|
@ -1335,6 +1342,10 @@ public class Minecraft implements Runnable {
|
||||||
this.joinPlayerCounter = 0;
|
this.joinPlayerCounter = 0;
|
||||||
this.theWorld.joinEntityInSurroundings(this.thePlayer);
|
this.theWorld.joinEntityInSurroundings(this.thePlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.showHints > 0) {
|
||||||
|
--this.showHints;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mcProfiler.endStartSection("gameRenderer");
|
this.mcProfiler.endStartSection("gameRenderer");
|
||||||
|
|
|
@ -96,6 +96,8 @@ public class GameSettings {
|
||||||
public boolean showDebugInfo;
|
public boolean showDebugInfo;
|
||||||
public boolean showDebugProfilerChart;
|
public boolean showDebugProfilerChart;
|
||||||
|
|
||||||
|
public boolean showCoordinates;
|
||||||
|
|
||||||
/** The lastServer string. */
|
/** The lastServer string. */
|
||||||
public String lastServer;
|
public String lastServer;
|
||||||
|
|
||||||
|
@ -131,6 +133,7 @@ public class GameSettings {
|
||||||
this.thirdPersonView = 0;
|
this.thirdPersonView = 0;
|
||||||
this.showDebugInfo = false;
|
this.showDebugInfo = false;
|
||||||
this.showDebugProfilerChart = true;
|
this.showDebugProfilerChart = true;
|
||||||
|
this.showCoordinates = false;
|
||||||
this.lastServer = "";
|
this.lastServer = "";
|
||||||
this.noclip = false;
|
this.noclip = false;
|
||||||
this.smoothCamera = false;
|
this.smoothCamera = false;
|
||||||
|
@ -496,6 +499,7 @@ public class GameSettings {
|
||||||
if(yee.hasKey("chatScale")) this.chatScale = yee.getFloat("chatScale");
|
if(yee.hasKey("chatScale")) this.chatScale = yee.getFloat("chatScale");
|
||||||
if(yee.hasKey("chatWidth")) this.chatWidth = yee.getFloat("chatWidth");
|
if(yee.hasKey("chatWidth")) this.chatWidth = yee.getFloat("chatWidth");
|
||||||
if(yee.hasKey("patchAnisotropic")) this.patchAnisotropic = yee.getBoolean("patchAnisotropic");
|
if(yee.hasKey("patchAnisotropic")) this.patchAnisotropic = yee.getBoolean("patchAnisotropic");
|
||||||
|
if(yee.hasKey("showCoordinates")) this.showCoordinates = yee.getBoolean("showCoordinates");
|
||||||
|
|
||||||
for (int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
for (int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
||||||
if(yee.hasKey(keyBindings[var4].keyDescription)) this.keyBindings[var4].keyCode = yee.getInteger(keyBindings[var4].keyDescription);
|
if(yee.hasKey(keyBindings[var4].keyDescription)) this.keyBindings[var4].keyCode = yee.getInteger(keyBindings[var4].keyDescription);
|
||||||
|
@ -549,6 +553,7 @@ public class GameSettings {
|
||||||
yee.setFloat("chatScale", this.chatScale);
|
yee.setFloat("chatScale", this.chatScale);
|
||||||
yee.setFloat("chatWidth", this.chatWidth);
|
yee.setFloat("chatWidth", this.chatWidth);
|
||||||
yee.setBoolean("patchAnisotropic", this.patchAnisotropic);
|
yee.setBoolean("patchAnisotropic", this.patchAnisotropic);
|
||||||
|
yee.setBoolean("showCoordinates", this.showCoordinates);
|
||||||
|
|
||||||
for (int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
for (int var4 = 0; var4 < this.keyBindings.length; ++var4) {
|
||||||
yee.setInteger(keyBindings[var4].keyDescription, keyBindings[var4].keyCode);
|
yee.setInteger(keyBindings[var4].keyDescription, keyBindings[var4].keyCode);
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.lax1dude.eaglercraft.ConfigConstants;
|
import net.lax1dude.eaglercraft.ConfigConstants;
|
||||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||||
|
import net.lax1dude.eaglercraft.EnumBrowser;
|
||||||
import net.lax1dude.eaglercraft.TextureLocation;
|
import net.lax1dude.eaglercraft.TextureLocation;
|
||||||
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||||
import net.lax1dude.eaglercraft.glemu.EffectPipeline;
|
import net.lax1dude.eaglercraft.glemu.EffectPipeline;
|
||||||
|
@ -397,17 +398,27 @@ public class GuiIngame extends Gui {
|
||||||
var8.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
|
var8.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
|
||||||
var8.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
|
var8.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
|
||||||
var8.drawStringWithShadow(this.mc.getWorldProviderName(), 2, 42, 16777215);
|
var8.drawStringWithShadow(this.mc.getWorldProviderName(), 2, 42, 16777215);
|
||||||
long var39;
|
String var45;
|
||||||
long var37;
|
int offset = 0;
|
||||||
long var41;
|
if(EaglerAdapter._wisWebGL()) {
|
||||||
var39 = EaglerAdapter.maxMemory();
|
var45 = "Game is running in a browser (" + EnumBrowser.getBrowser().toString() + ")";
|
||||||
var37 = EaglerAdapter.totalMemory();
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 2, 14737632);
|
||||||
var41 = EaglerAdapter.freeMemory();
|
offset = -10;
|
||||||
long var44 = var37 - var41;
|
}else {
|
||||||
String var45 = "Used memory: " + var44 * 100L / var39 + "% (" + var44 / 1024L / 1024L + "MB) of " + var39 / 1024L / 1024L + "MB";
|
long var39;
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 2, 14737632);
|
long var37;
|
||||||
var45 = "Allocated memory: " + var37 * 100L / var39 + "% (" + var37 / 1024L / 1024L + "MB)";
|
long var41;
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 12, 14737632);
|
var39 = EaglerAdapter.maxMemory();
|
||||||
|
var37 = EaglerAdapter.totalMemory();
|
||||||
|
var41 = EaglerAdapter.freeMemory();
|
||||||
|
long var44 = var37 - var41;
|
||||||
|
var45 = "Used memory: " + var44 * 100L / var39 + "% (" + var44 / 1024L / 1024L + "MB) of " + var39 / 1024L / 1024L + "MB";
|
||||||
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 2, 14737632);
|
||||||
|
var45 = "Allocated memory: " + var37 * 100L / var39 + "% (" + var37 / 1024L / 1024L + "MB)";
|
||||||
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 12, 14737632);
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
this.drawString(var8, "Player is not using an xbox live account", 2, 64, 0xFFBBBB);
|
this.drawString(var8, "Player is not using an xbox live account", 2, 64, 0xFFBBBB);
|
||||||
this.drawString(var8, "Using cracked server @ " + mc.getServerURI(), 2, 73, 0xFFBBBB);
|
this.drawString(var8, "Using cracked server @ " + mc.getServerURI(), 2, 73, 0xFFBBBB);
|
||||||
var47 = MathHelper.floor_double(this.mc.thePlayer.posX);
|
var47 = MathHelper.floor_double(this.mc.thePlayer.posX);
|
||||||
|
@ -418,28 +429,29 @@ public class GuiIngame extends Gui {
|
||||||
this.drawString(var8, "z: "+doubleToShorterString(this.mc.thePlayer.posZ)+" ("+var23+") // c: "+(var23 >> 4)+" ("+(var23 & 15)+")", 2, 108, 14737632);
|
this.drawString(var8, "z: "+doubleToShorterString(this.mc.thePlayer.posZ)+" ("+var23+") // c: "+(var23 >> 4)+" ("+(var23 & 15)+")", 2, 108, 14737632);
|
||||||
var24 = MathHelper.floor_double((double) (this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
var24 = MathHelper.floor_double((double) (this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||||
this.drawString(var8, "f: " + var24 + " (" + Direction.directions[var24] + ") / " + MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw), 2, 116, 14737632);
|
this.drawString(var8, "f: " + var24 + " (" + Direction.directions[var24] + ") / " + MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw), 2, 116, 14737632);
|
||||||
|
this.drawString(var8, "Press F+6 to " + (mc.gameSettings.showCoordinates ? "disable" : "enable") + " showing coords in ingame GUI", 2, 135, 0xFFFFFFFF);
|
||||||
|
|
||||||
//this.drawString(var8, String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", new Object[] { Float.valueOf(this.mc.thePlayer.capabilities.getWalkSpeed()), Float.valueOf(this.mc.thePlayer.capabilities.getFlySpeed()),
|
//this.drawString(var8, String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", new Object[] { Float.valueOf(this.mc.thePlayer.capabilities.getWalkSpeed()), Float.valueOf(this.mc.thePlayer.capabilities.getFlySpeed()),
|
||||||
// Boolean.valueOf(this.mc.thePlayer.onGround), Integer.valueOf(this.mc.theWorld.getHeightValue(var47, var23)) }), 2, 104, 14737632);
|
// Boolean.valueOf(this.mc.thePlayer.onGround), Integer.valueOf(this.mc.theWorld.getHeightValue(var47, var23)) }), 2, 104, 14737632);
|
||||||
var45 = "opengl emulator status - v1.0";
|
var45 = "opengl emulator status - v1.0";
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 36, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 36, 14737632);
|
||||||
var45 = "lists: "+EaglerAdapter.getDisplayListCount()+", upload: "+(EaglerAdapter.getBitsPerSecond() / 1000000)+"mbps";
|
var45 = "lists: "+EaglerAdapter.getDisplayListCount()+", upload: "+(EaglerAdapter.getBitsPerSecond() / 1000000)+"mbps";
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 46, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 46, 14737632);
|
||||||
var45 = "verts: "+(EaglerAdapter.getVertexesPerSecond() / 1000)+"k, triangles: "+(EaglerAdapter.getTrianglesPerSecond() / 1000)+"k";
|
var45 = "verts: "+(EaglerAdapter.getVertexesPerSecond() / 1000)+"k, triangles: "+(EaglerAdapter.getTrianglesPerSecond() / 1000)+"k";
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 56, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 56, 14737632);
|
||||||
var45 = "rendering backend: "+(EaglerAdapter.isWebGL ? "webgl20" : "opengl30");
|
var45 = "rendering backend: "+(EaglerAdapter.isWebGL ? "webgl20" : "opengl30");
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 66, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 66, 14737632);
|
||||||
var45 = "glsl "+(EaglerAdapter._wgetShaderHeader() +", 32 bytes/vert");
|
var45 = "glsl "+(EaglerAdapter._wgetShaderHeader() +", 32 bytes/vert");
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 76, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 76, 14737632);
|
||||||
var45 = "Bound Shaders:";
|
var45 = "Bound Shaders:";
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 100, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 100, 14737632);
|
||||||
var45 = "/glsl/core.glsl";
|
var45 = "/glsl/core.glsl";
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 110, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 110, 14737632);
|
||||||
var45 = "/glsl/occl.glsl";
|
var45 = "/glsl/occl.glsl";
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 120, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 120, 14737632);
|
||||||
for(int i = 0; i < EffectPipeline.pipeline.length; i++) {
|
for(int i = 0; i < EffectPipeline.pipeline.length; i++) {
|
||||||
var45 = EffectPipeline.pipeline[i];
|
var45 = EffectPipeline.pipeline[i];
|
||||||
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 130 + i*10, 14737632);
|
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 130 + i*10, 14737632);
|
||||||
}
|
}
|
||||||
EaglerAdapter.glPopMatrix();
|
EaglerAdapter.glPopMatrix();
|
||||||
this.mc.mcProfiler.endSection();
|
this.mc.mcProfiler.endSection();
|
||||||
|
@ -447,7 +459,15 @@ public class GuiIngame extends Gui {
|
||||||
EaglerAdapter.glPushMatrix();
|
EaglerAdapter.glPushMatrix();
|
||||||
EaglerAdapter.glScalef(0.75f, 0.75f, 0.75f);
|
EaglerAdapter.glScalef(0.75f, 0.75f, 0.75f);
|
||||||
var8.drawStringWithShadow(this.mc.renderGlobal.getDebugInfoShort(), 2, 2, 16777215);
|
var8.drawStringWithShadow(this.mc.renderGlobal.getDebugInfoShort(), 2, 2, 16777215);
|
||||||
var8.drawStringWithShadow("x: "+MathHelper.floor_double(this.mc.thePlayer.posX)+", y: "+MathHelper.floor_double(this.mc.thePlayer.posY)+", z: "+MathHelper.floor_double(this.mc.thePlayer.posZ), 2, 12, 16777215);
|
|
||||||
|
if(mc.gameSettings.showCoordinates) {
|
||||||
|
var8.drawStringWithShadow("x: "+MathHelper.floor_double(this.mc.thePlayer.posX)+", y: "+MathHelper.floor_double(this.mc.thePlayer.posY)+", z: "+MathHelper.floor_double(this.mc.thePlayer.posZ), 2, 12, 16777215);
|
||||||
|
}else {
|
||||||
|
if(mc.showHints > 0) {
|
||||||
|
var8.drawStringWithShadow("Press F+6 to show coordinates", 2, 12, 16777215);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int offset = this.mc.isChatOpen() ? 135 : 0;
|
int offset = this.mc.isChatOpen() ? 135 : 0;
|
||||||
int offset2 = this.mc.isChatOpen() ? 4 : 0;
|
int offset2 = this.mc.isChatOpen() ? 4 : 0;
|
||||||
String str = "not using an xbox live account";
|
String str = "not using an xbox live account";
|
||||||
|
|
|
@ -164,6 +164,8 @@ public class EaglerAdapterImpl2 {
|
||||||
public static HTMLDocument doc = null;
|
public static HTMLDocument doc = null;
|
||||||
public static HTMLElement parent = null;
|
public static HTMLElement parent = null;
|
||||||
public static HTMLCanvasElement canvas = null;
|
public static HTMLCanvasElement canvas = null;
|
||||||
|
public static CanvasRenderingContext2D frameBuffer = null;
|
||||||
|
public static HTMLCanvasElement renderingCanvas = null;
|
||||||
public static WebGL2RenderingContext webgl = null;
|
public static WebGL2RenderingContext webgl = null;
|
||||||
public static Window win = null;
|
public static Window win = null;
|
||||||
private static byte[] loadedPackage = null;
|
private static byte[] loadedPackage = null;
|
||||||
|
@ -207,8 +209,14 @@ public class EaglerAdapterImpl2 {
|
||||||
doc = win.getDocument();
|
doc = win.getDocument();
|
||||||
canvas = (HTMLCanvasElement)doc.createElement("canvas");
|
canvas = (HTMLCanvasElement)doc.createElement("canvas");
|
||||||
canvas.setAttribute("id", "deevis589723589");
|
canvas.setAttribute("id", "deevis589723589");
|
||||||
|
canvas.setWidth(parent.getClientWidth());
|
||||||
|
canvas.setHeight(parent.getClientHeight());
|
||||||
rootElement.appendChild(canvas);
|
rootElement.appendChild(canvas);
|
||||||
webgl = (WebGL2RenderingContext) canvas.getContext("webgl2", youEagler());
|
renderingCanvas = (HTMLCanvasElement)doc.createElement("canvas");
|
||||||
|
renderingCanvas.setWidth(canvas.getWidth());
|
||||||
|
renderingCanvas.setHeight(canvas.getHeight());
|
||||||
|
frameBuffer = (CanvasRenderingContext2D) canvas.getContext("2d");
|
||||||
|
webgl = (WebGL2RenderingContext) renderingCanvas.getContext("webgl2", youEagler());
|
||||||
if(webgl == null) {
|
if(webgl == null) {
|
||||||
throw new RuntimeException("WebGL 2.0 is not supported in your browser ("+getString("window.navigator.userAgent")+")");
|
throw new RuntimeException("WebGL 2.0 is not supported in your browser ("+getString("window.navigator.userAgent")+")");
|
||||||
}
|
}
|
||||||
|
@ -1540,16 +1548,48 @@ public class EaglerAdapterImpl2 {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
private static native Object interrupt();
|
||||||
|
|
||||||
|
private static void interrupt(final AsyncCallback<Object> cb) {
|
||||||
|
Window.setTimeout(new TimerHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTimer() {
|
||||||
|
cb.complete(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
@JSBody(params = { "obj" }, script = "if(obj.commit) obj.commit();")
|
@JSBody(params = { "obj" }, script = "if(obj.commit) obj.commit();")
|
||||||
private static native int commitContext(JSObject obj);
|
private static native int commitContext(JSObject obj);
|
||||||
|
|
||||||
public static final void updateDisplay() {
|
public static final void updateDisplay() {
|
||||||
commitContext(webgl);
|
//commitContext(webgl);
|
||||||
|
int w = parent.getClientWidth();
|
||||||
|
int h = parent.getClientHeight();
|
||||||
|
if(canvas.getWidth() != w) {
|
||||||
|
canvas.setWidth(w);
|
||||||
|
}
|
||||||
|
if(canvas.getHeight() != h) {
|
||||||
|
canvas.setHeight(h);
|
||||||
|
}
|
||||||
|
frameBuffer.drawImage(renderingCanvas, 0, 0, w, h);
|
||||||
|
if(renderingCanvas.getWidth() != w) {
|
||||||
|
renderingCanvas.setWidth(w);
|
||||||
|
}
|
||||||
|
if(renderingCanvas.getHeight() != h) {
|
||||||
|
renderingCanvas.setHeight(h);
|
||||||
|
}
|
||||||
|
/*
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1l);
|
Thread.sleep(1l);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
interrupt();
|
||||||
}
|
}
|
||||||
public static final void setVSyncEnabled(boolean p1) {
|
public static final void setVSyncEnabled(boolean p1) {
|
||||||
|
|
||||||
|
@ -1580,14 +1620,10 @@ public class EaglerAdapterImpl2 {
|
||||||
return win.getScreen().getAvailHeight();
|
return win.getScreen().getAvailHeight();
|
||||||
}
|
}
|
||||||
public static final int getCanvasWidth() {
|
public static final int getCanvasWidth() {
|
||||||
int w = parent.getClientWidth();
|
return renderingCanvas.getWidth();
|
||||||
canvas.setWidth(w);
|
|
||||||
return w;
|
|
||||||
}
|
}
|
||||||
public static final int getCanvasHeight() {
|
public static final int getCanvasHeight() {
|
||||||
int h = parent.getClientHeight();
|
return renderingCanvas.getHeight();
|
||||||
canvas.setHeight(h);
|
|
||||||
return h;
|
|
||||||
}
|
}
|
||||||
public static final void setDisplaySize(int x, int y) {
|
public static final void setDisplaySize(int x, int y) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user