use full window canvas and try to use the real size in pixel...

This commit is contained in:
Hannes Janetzek 2013-06-30 08:49:06 +02:00
parent c002b8a3c3
commit 099ab0e817
4 changed files with 537 additions and 183 deletions

View File

@ -1,15 +1,19 @@
package org.oscim.gdx.client;
// -draftCompile -localWorkers 2
import org.oscim.core.Tile;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.badlogic.gdx.backends.gwt.GwtGraphics;
public class GwtLauncher extends GwtApplication {
@Override
public GwtApplicationConfiguration getConfig () {
GwtApplicationConfiguration cfg = new GwtApplicationConfiguration(1400, 800);
public GwtApplicationConfiguration getConfig() {
GwtApplicationConfiguration cfg = new GwtApplicationConfiguration(GwtGraphics.getWindowWidthJSNI(),
GwtGraphics.getWindowHeightJSNI() );
cfg.stencil = true;
cfg.fps = 25;
@ -17,8 +21,12 @@ public class GwtLauncher extends GwtApplication {
}
@Override
public ApplicationListener getApplicationListener () {
public ApplicationListener getApplicationListener() {
if (GwtGraphics.getDevicePixelRatioJSNI() > 1)
Tile.SIZE = 400;
else
Tile.SIZE = 360;
return new GwtGdxMap();
}
}
}

View File

@ -49,13 +49,16 @@ import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.VerticalPanel;
/** Implementation of an {@link Application} based on GWT. Clients have to override {@link #getConfig()} and
* {@link #getApplicationListener()}. Clients can override the default loading screen via
* {@link #getPreloaderCallback()} and implement any loading screen drawing via GWT widgets.
* @author mzechner */
/**
* Implementation of an {@link Application} based on GWT. Clients have to
* override {@link #getConfig()} and {@link #getApplicationListener()}. Clients
* can override the default loading screen via {@link #getPreloaderCallback()}
* and implement any loading screen drawing via GWT widgets.
*
* @author mzechner
*/
public abstract class GwtApplication implements EntryPoint, Application {
private ApplicationListener listener;
private GwtApplicationConfiguration config;
@ -63,7 +66,6 @@ public abstract class GwtApplication implements EntryPoint, Application {
private GwtInput input;
private GwtNet net;
private Panel root = null;
private TextArea log = null;
private int logLevel = LOG_ERROR;
private Array<Runnable> runnables = new Array<Runnable>();
private Array<Runnable> runnablesHelper = new Array<Runnable>();
@ -74,15 +76,13 @@ public abstract class GwtApplication implements EntryPoint, Application {
private ObjectMap<String, Preferences> prefs = new ObjectMap<String, Preferences>();
/** @return the configuration for the {@link GwtApplication}. */
public abstract GwtApplicationConfiguration getConfig ();
public abstract GwtApplicationConfiguration getConfig();
@Override
public void onModuleLoad () {
consoleLog("onModuleLoad");
public void onModuleLoad() {
this.agentInfo = computeAgentInfo();
this.listener = getApplicationListener();
this.config = getConfig();
this.log = config.log;
if (config.rootPanel != null) {
this.root = config.rootPanel;
@ -117,32 +117,32 @@ public abstract class GwtApplication implements EntryPoint, Application {
// called (function instanceof Function fails, wtf JS?).
new Timer() {
@Override
public void run () {
public void run() {
//if (SoundManager.ok()) {
final PreloaderCallback callback = getPreloaderCallback();
preloader = new Preloader();
preloader.preload("assets.txt", new PreloaderCallback() {
@Override
public void error (String file) {
callback.error(file);
}
final PreloaderCallback callback = getPreloaderCallback();
preloader = new Preloader();
preloader.preload("assets.txt", new PreloaderCallback() {
@Override
public void error(String file) {
callback.error(file);
}
@Override
public void update (PreloaderState state) {
callback.update(state);
if (state.hasEnded()) {
root.clear();
setupLoop();
}
@Override
public void update(PreloaderState state) {
callback.update(state);
if (state.hasEnded()) {
root.clear();
setupLoop();
}
});
cancel();
}
});
cancel();
//}
}
}.scheduleRepeating(100);
}
private void setupLoop () {
private void setupLoop() {
// setup modules
consoleLog("setupLoop");
try {
@ -152,8 +152,10 @@ public abstract class GwtApplication implements EntryPoint, Application {
root.add(new Label("Sorry, your browser doesn't seem to support WebGL"));
return;
}
lastWidth = graphics.getWidth();
lastHeight = graphics.getHeight();
Gdx.app = this;
//Gdx.audio = new GwtAudio();
Gdx.graphics = graphics;
@ -164,11 +166,15 @@ public abstract class GwtApplication implements EntryPoint, Application {
Gdx.input = this.input;
this.net = new GwtNet();
Gdx.net = this.net;
final double pixelRatio = GwtGraphics.getDevicePixelRatioJSNI();
consoleLog(">>>> " + config.width + "x"+ config.height + " ratio " + pixelRatio);
// tell listener about app creation
try {
listener.create();
listener.resize(graphics.getWidth(), graphics.getHeight());
listener.resize(
(int)(graphics.getWidth()),
(int)(graphics.getHeight()));
} catch (Throwable t) {
error("GwtApplication", "exception: " + t.getMessage(), t);
t.printStackTrace();
@ -178,14 +184,17 @@ public abstract class GwtApplication implements EntryPoint, Application {
// setup rendering timer
new Timer() {
@Override
public void run () {
public void run() {
try {
graphics.update();
if (Gdx.graphics.getWidth() != lastWidth || Gdx.graphics.getHeight() != lastHeight) {
GwtApplication.this.listener.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
if (Gdx.graphics.getWidth() != lastWidth
|| Gdx.graphics.getHeight() != lastHeight) {
GwtApplication.this.listener.resize(
(int)(Gdx.graphics.getWidth()),
(int)(Gdx.graphics.getHeight()));
lastWidth = graphics.getWidth();
lastHeight = graphics.getHeight();
Gdx.gl.glViewport(0, 0, lastWidth, lastHeight);
//Gdx.gl.glViewport(0, 0, lastWidth, lastHeight);
}
runnablesHelper.addAll(runnables);
runnables.clear();
@ -200,16 +209,16 @@ public abstract class GwtApplication implements EntryPoint, Application {
throw new RuntimeException(t);
}
}
}.scheduleRepeating((int)((1f / config.fps) * 1000));
}.scheduleRepeating((int) ((1f / config.fps) * 1000));
}
public Panel getRootPanel () {
public Panel getRootPanel() {
return root;
}
long loadStart = TimeUtils.nanoTime();
public PreloaderCallback getPreloaderCallback () {
public PreloaderCallback getPreloaderCallback() {
final Panel preloaderPanel = new VerticalPanel();
preloaderPanel.setStyleName("gdx-preloader");
final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png");
@ -227,12 +236,12 @@ public abstract class GwtApplication implements EntryPoint, Application {
return new PreloaderCallback() {
@Override
public void error (String file) {
public void error(String file) {
System.out.println("error: " + file);
}
@Override
public void update (PreloaderState state) {
public void update(PreloaderState state) {
meterStyle.setWidth(100f * state.getProgress(), Unit.PCT);
}
@ -240,22 +249,22 @@ public abstract class GwtApplication implements EntryPoint, Application {
}
@Override
public Graphics getGraphics () {
public Graphics getGraphics() {
return graphics;
}
@Override
public Audio getAudio () {
public Audio getAudio() {
return Gdx.audio;
}
@Override
public Input getInput () {
public Input getInput() {
return Gdx.input;
}
@Override
public Files getFiles () {
public Files getFiles() {
return Gdx.files;
}
@ -264,79 +273,51 @@ public abstract class GwtApplication implements EntryPoint, Application {
return Gdx.net;
}
private void checkLogLabel () {
if (log == null) {
log = new TextArea();
log.setSize(graphics.getWidth() + "px", "200px");
log.setReadOnly(true);
root.add(log);
}
}
@Override
public void log (String tag, String message) {
public void log(String tag, String message) {
if (logLevel >= LOG_INFO) {
checkLogLabel();
log.setText(log.getText() + "\n" + tag + ": " + message);
log.setCursorPos(log.getText().length() - 1);
System.out.println(tag + ": " + message);
consoleLog(tag + ": " + message);
}
}
@Override
public void log (String tag, String message, Exception exception) {
public void log(String tag, String message, Exception exception) {
if (logLevel >= LOG_INFO) {
checkLogLabel();
log.setText(log.getText() + "\n" + tag + ": " + message + "\n" + exception.getMessage() + "\n");
log.setCursorPos(log.getText().length() - 1);
System.out.println(tag + ": " + message + "\n" + exception.getMessage());
System.out.println(getStackTrace(exception));
consoleLog(tag + ": " + message + "\n" + exception.getMessage());
consoleLog(getStackTrace(exception));
}
}
@Override
public void error (String tag, String message) {
public void error(String tag, String message) {
if (logLevel >= LOG_ERROR) {
checkLogLabel();
log.setText(log.getText() + "\n" + tag + ": " + message);
log.setCursorPos(log.getText().length() - 1);
System.err.println(tag + ": " + message);
consoleLog(tag + ": " + message);
}
}
@Override
public void error (String tag, String message, Throwable exception) {
public void error(String tag, String message, Throwable exception) {
if (logLevel >= LOG_ERROR) {
checkLogLabel();
log.setText(log.getText() + "\n" + tag + ": " + message + "\n" + exception.getMessage());
log.setCursorPos(log.getText().length() - 1);
System.err.println(tag + ": " + message + "\n" + exception.getMessage() + "\n");
System.out.println(getStackTrace(exception));
consoleLog(getStackTrace(exception));
}
}
@Override
public void debug (String tag, String message) {
public void debug(String tag, String message) {
if (logLevel >= LOG_DEBUG) {
checkLogLabel();
log.setText(log.getText() + "\n" + tag + ": " + message + "\n");
log.setCursorPos(log.getText().length() - 1);
System.out.println(tag + ": " + message + "\n");
consoleLog(tag + ": " + message + "\n");
}
}
@Override
public void debug (String tag, String message, Throwable exception) {
public void debug(String tag, String message, Throwable exception) {
if (logLevel >= LOG_DEBUG) {
checkLogLabel();
log.setText(log.getText() + "\n" + tag + ": " + message + "\n" + exception.getMessage() + "\n");
log.setCursorPos(log.getText().length() - 1);
System.out.println(tag + ": " + message + "\n" + exception.getMessage());
System.out.println(getStackTrace(exception));
consoleLog(tag + ": " + message + "\n" + exception.getMessage());
consoleLog(getStackTrace(exception));
}
}
private String getStackTrace (Throwable e) {
private String getStackTrace(Throwable e) {
StringBuffer buffer = new StringBuffer();
for (StackTraceElement trace : e.getStackTrace()) {
buffer.append(trace.toString() + "\n");
@ -345,32 +326,32 @@ public abstract class GwtApplication implements EntryPoint, Application {
}
@Override
public void setLogLevel (int logLevel) {
public void setLogLevel(int logLevel) {
this.logLevel = logLevel;
}
@Override
public ApplicationType getType () {
public ApplicationType getType() {
return ApplicationType.WebGL;
}
@Override
public int getVersion () {
public int getVersion() {
return 0;
}
@Override
public long getJavaHeap () {
public long getJavaHeap() {
return 0;
}
@Override
public long getNativeHeap () {
public long getNativeHeap() {
return 0;
}
@Override
public Preferences getPreferences (String name) {
public Preferences getPreferences(String name) {
Preferences pref = prefs.get(name);
if (pref == null) {
pref = new GwtPreferences(name);
@ -383,109 +364,112 @@ public abstract class GwtApplication implements EntryPoint, Application {
public Clipboard getClipboard() {
return new Clipboard() {
@Override
public String getContents () {
public String getContents() {
return null;
}
@Override
public void setContents (String content) {
public void setContents(String content) {
}
};
}
@Override
public void postRunnable (Runnable runnable) {
public void postRunnable(Runnable runnable) {
runnables.add(runnable);
}
@Override
public void exit () {
public void exit() {
}
/** Contains precomputed information on the user-agent. Useful for dealing with browser and OS behavioral differences. Kindly
* borrowed from PlayN */
public static AgentInfo agentInfo () {
/**
* Contains precomputed information on the user-agent. Useful for dealing
* with browser and OS behavioral differences. Kindly
* borrowed from PlayN
*/
public static AgentInfo agentInfo() {
return agentInfo;
}
/** kindly borrowed from PlayN **/
private static native AgentInfo computeAgentInfo () /*-{
var userAgent = navigator.userAgent.toLowerCase();
return {
// browser type flags
isFirefox : userAgent.indexOf("firefox") != -1,
isChrome : userAgent.indexOf("chrome") != -1,
isSafari : userAgent.indexOf("safari") != -1,
isOpera : userAgent.indexOf("opera") != -1,
isIE : userAgent.indexOf("msie") != -1,
// OS type flags
isMacOS : userAgent.indexOf("mac") != -1,
isLinux : userAgent.indexOf("linux") != -1,
isWindows : userAgent.indexOf("win") != -1
};
}-*/;
private static native AgentInfo computeAgentInfo() /*-{
var userAgent = navigator.userAgent.toLowerCase();
return {
// browser type flags
isFirefox : userAgent.indexOf("firefox") != -1,
isChrome : userAgent.indexOf("chrome") != -1,
isSafari : userAgent.indexOf("safari") != -1,
isOpera : userAgent.indexOf("opera") != -1,
isIE : userAgent.indexOf("msie") != -1,
// OS type flags
isMacOS : userAgent.indexOf("mac") != -1,
isLinux : userAgent.indexOf("linux") != -1,
isWindows : userAgent.indexOf("win") != -1
};
}-*/;
/** Returned by {@link #agentInfo}. Kindly borrowed from PlayN. */
public static class AgentInfo extends JavaScriptObject {
public final native boolean isFirefox () /*-{
return this.isFirefox;
}-*/;
public final native boolean isFirefox() /*-{
return this.isFirefox;
}-*/;
public final native boolean isChrome () /*-{
return this.isChrome;
}-*/;
public final native boolean isChrome() /*-{
return this.isChrome;
}-*/;
public final native boolean isSafari () /*-{
return this.isSafari;
}-*/;
public final native boolean isSafari() /*-{
return this.isSafari;
}-*/;
public final native boolean isOpera () /*-{
return this.isOpera;
}-*/;
public final native boolean isOpera() /*-{
return this.isOpera;
}-*/;
public final native boolean isIE () /*-{
return this.isIE;
}-*/;
public final native boolean isIE() /*-{
return this.isIE;
}-*/;
public final native boolean isMacOS () /*-{
return this.isMacOS;
}-*/;
public final native boolean isMacOS() /*-{
return this.isMacOS;
}-*/;
public final native boolean isLinux () /*-{
return this.isLinux;
}-*/;
public final native boolean isLinux() /*-{
return this.isLinux;
}-*/;
public final native boolean isWindows () /*-{
return this.isWindows;
}-*/;
public final native boolean isWindows() /*-{
return this.isWindows;
}-*/;
protected AgentInfo () {
protected AgentInfo() {
}
}
public String getBaseUrl () {
public String getBaseUrl() {
return preloader.baseUrl;
}
public Preloader getPreloader () {
public Preloader getPreloader() {
return preloader;
}
@Override
public void addLifecycleListener (LifecycleListener listener) {
synchronized(lifecycleListeners) {
public void addLifecycleListener(LifecycleListener listener) {
synchronized (lifecycleListeners) {
lifecycleListeners.add(listener);
}
}
@Override
public void removeLifecycleListener (LifecycleListener listener) {
synchronized(lifecycleListeners) {
public void removeLifecycleListener(LifecycleListener listener) {
synchronized (lifecycleListeners) {
lifecycleListeners.removeValue(listener, true);
}
}
native void consoleLog(String message) /*-{
console.log( "GWT:" + message );
private native void consoleLog(String message) /*-{
console.log(message);
}-*/;
}

View File

@ -0,0 +1,346 @@
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.backends.gwt;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.GL11;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.GLCommon;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.google.gwt.canvas.client.Canvas;
import com.google.gwt.dom.client.CanvasElement;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.webgl.client.WebGLContextAttributes;
import com.google.gwt.webgl.client.WebGLRenderingContext;
public class GwtGraphics implements Graphics {
CanvasElement canvas;
WebGLRenderingContext context;
GL20 gl;
String extensions;
float fps = 0;
long lastTimeStamp = System.currentTimeMillis();
float deltaTime = 0;
float time = 0;
int frames;
GwtApplicationConfiguration config;
boolean inFullscreenMode = false;
double pixelRatio;
public GwtGraphics(Panel root, GwtApplicationConfiguration config) {
Canvas canvasWidget = Canvas.createIfSupported();
if (canvasWidget == null)
throw new GdxRuntimeException("Canvas not supported");
canvas = canvasWidget.getCanvasElement();
root.add(canvasWidget);
this.pixelRatio = getDevicePixelRatioJSNI();
canvas.setWidth((int) (config.width * pixelRatio));
canvas.setHeight((int) (config.height * pixelRatio));
canvas.getStyle().setWidth(config.width, Unit.PX);
canvas.getStyle().setHeight(config.height, Unit.PX);
this.config = config;
WebGLContextAttributes attributes = WebGLContextAttributes.create();
attributes.setAntialias(config.antialiasing);
attributes.setStencil(config.stencil);
attributes.setAlpha(false);
attributes.setPremultipliedAlpha(false);
context = WebGLRenderingContext.getContext(canvas, attributes);
context.viewport(0, 0, config.width, config.height);
this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGL20(context);
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
int w = getWindowWidthJSNI();
int h = getWindowHeightJSNI();
canvas.getStyle().setWidth(w, Unit.PX);
canvas.getStyle().setHeight(h, Unit.PX);
Gdx.app.log("onResize", w + "/" + h);
canvas.setWidth((int) (w * pixelRatio));
canvas.setHeight((int) (h * pixelRatio));
}
});
}
public static native double getDevicePixelRatioJSNI() /*-{
return $wnd.devicePixelRatio || 1.0;
}-*/;
public static native int getWindowWidthJSNI() /*-{
return $wnd.innerWidth;
}-*/;
public static native int getWindowHeightJSNI() /*-{
return $wnd.innerHeight;
}-*/;
public WebGLRenderingContext getContext() {
return context;
}
@Override
public boolean isGL11Available() {
return false;
}
@Override
public boolean isGL20Available() {
return true;
}
@Override
public GLCommon getGLCommon() {
return gl;
}
@Override
public GL10 getGL10() {
return null;
}
@Override
public GL11 getGL11() {
return null;
}
@Override
public GL20 getGL20() {
return gl;
}
@Override
public int getWidth() {
return canvas.getWidth();
}
@Override
public int getHeight() {
return canvas.getHeight();
}
@Override
public float getDeltaTime() {
return deltaTime;
}
@Override
public int getFramesPerSecond() {
return (int) fps;
}
@Override
public GraphicsType getType() {
return GraphicsType.WebGL;
}
@Override
public float getPpiX() {
return 96;
}
@Override
public float getPpiY() {
return 96;
}
@Override
public float getPpcX() {
return 96 / 2.54f;
}
@Override
public float getPpcY() {
return 96 / 2.54f;
}
@Override
public boolean supportsDisplayModeChange() {
return true;
}
@Override
public DisplayMode[] getDisplayModes() {
return new DisplayMode[] { new DisplayMode(getScreenWidthJSNI(), getScreenHeightJSNI(), 60,
8) {
} };
}
private native int getScreenWidthJSNI() /*-{
return $wnd.screen.width;
}-*/;
private native int getScreenHeightJSNI() /*-{
return $wnd.screen.height;
}-*/;
private native boolean isFullscreenJSNI() /*-{
if ("webkitIsFullScreen" in $doc) {
return $doc.webkitIsFullScreen;
}
if ("mozFullScreen" in $doc) {
return $doc.mozFullScreen;
}
return false
}-*/;
private void fullscreenChanged() {
if (!isFullscreen()) {
canvas.setWidth(config.width);
canvas.setHeight(config.height);
}
}
private native boolean setFullscreenJSNI(GwtGraphics graphics, CanvasElement element) /*-{
if (element.webkitRequestFullScreen) {
element.width = $wnd.screen.width;
element.height = $wnd.screen.height;
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
$doc.addEventListener(
"webkitfullscreenchange",
function() {
graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()();
}, false);
return true;
}
if (element.mozRequestFullScreen) {
element.width = $wnd.screen.width;
element.height = $wnd.screen.height;
element.mozRequestFullScreen();
$doc.addEventListener(
"mozfullscreenchange",
function() {
graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()();
}, false);
return true;
}
return false;
}-*/;
private native void exitFullscreen() /*-{
if ($doc.webkitExitFullscreen)
$doc.webkitExitFullscreen();
if ($doc.mozExitFullscreen)
$doc.mozExitFullscreen();
}-*/;
@Override
public DisplayMode getDesktopDisplayMode() {
return new DisplayMode(getScreenWidthJSNI(), getScreenHeightJSNI(), 60, 8) {
};
}
@Override
public boolean setDisplayMode(DisplayMode displayMode) {
if (displayMode.width != getScreenWidthJSNI()
&& displayMode.height != getScreenHeightJSNI())
return false;
return setFullscreenJSNI(this, canvas);
}
@Override
public boolean setDisplayMode(int width, int height, boolean fullscreen) {
if (fullscreen) {
if (width != getScreenWidthJSNI() && height != getScreenHeightJSNI())
return false;
return setFullscreenJSNI(this, canvas);
} else {
if (isFullscreenJSNI())
exitFullscreen();
canvas.setWidth(width);
canvas.setHeight(height);
canvas.getStyle().setWidth(width, Unit.PX);
canvas.getStyle().setHeight(height, Unit.PX);
return true;
}
}
@Override
public BufferFormat getBufferFormat() {
return new BufferFormat(8, 8, 8, 0, 16, config.stencil ? 8 : 0, 0, false);
}
@Override
public boolean supportsExtension(String extension) {
if (extensions == null)
extensions = Gdx.gl.glGetString(GL10.GL_EXTENSIONS);
return extensions.contains(extension);
}
public void update() {
long currTimeStamp = System.currentTimeMillis();
deltaTime = (currTimeStamp - lastTimeStamp) / 1000.0f;
lastTimeStamp = currTimeStamp;
time += deltaTime;
frames++;
if (time > 1) {
this.fps = frames;
time = 0;
frames = 0;
}
}
@Override
public void setTitle(String title) {
}
@Override
public void setVSync(boolean vsync) {
}
@Override
public float getDensity() {
return 96.0f / 160;
}
@Override
public void setContinuousRendering(boolean isContinuous) {
}
@Override
public boolean isContinuousRendering() {
return false;
}
@Override
public void requestRendering() {
}
@Override
public float getRawDeltaTime() {
return getDeltaTime();
}
@Override
public boolean isFullscreen() {
return isFullscreenJSNI();
}
}

View File

@ -1,35 +1,51 @@
<!doctype html>
<html>
<head>
<title>vtm-gdx</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
canvas {
cursor: default;
outline: none;
}
</style>
</head>
<body>
<div align="center" id="embed-org.oscim.gdx.GwtDefinition"></div>
<script type="text/javascript" src="org.oscim.gdx.GwtDefinition/org.oscim.gdx.GwtDefinition.nocache.js"></script>
</body>
<script>
function handleMouseDown(evt) {
evt.preventDefault();
evt.stopPropagation();
evt.target.style.cursor = 'default';
}
function handleMouseUp(evt) {
evt.preventDefault();
evt.stopPropagation();
evt.target.style.cursor = '';
}
document.getElementById('embed-org.oscim.gdx.GwtDefinition').addEventListener('mousedown', handleMouseDown, false);
document.getElementById('embed-org.oscim.gdx.GwtDefinition').addEventListener('mouseup', handleMouseUp, false);
</script>
<head>
<title>vtm-gdx</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- pixel and dpi are way too simple concepts for web devs, lets also have css-pixels! -->
<!-- http://www.html5rocks.com/de/mobile/touch/ -->
<!-- http://www.quirksmode.org/mobile/viewports.html -->
<!-- http://www.quirksmode.org/blog/archives/2012/07/more_about_devi.html -->
<!-- devicePixelRatio: http://coding.smashingmagazine.com/2012/08/20/towards-retina-web/ -->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<style>
canvas {
cursor: default;
outline: none;
position: fixed;
left: 0;
top: 0;
}
</style>
</head>
<body>
<script type="text/javascript" src="js/_tessellate.js"></script>
<script type="text/javascript" src="js/tessellate.js"></script>
<div align="center" id="embed-org.oscim.gdx.GwtDefinition"></div>
<script type="text/javascript"
src="org.oscim.gdx.GwtDefinition/org.oscim.gdx.GwtDefinition.nocache.js"></script>
</body>
<script>
function handleMouseDown(evt) {
evt.preventDefault();
evt.stopPropagation();
evt.target.style.cursor = 'default';
}
function handleMouseUp(evt) {
evt.preventDefault();
evt.stopPropagation();
evt.target.style.cursor = '';
}
document.getElementById('embed-org.oscim.gdx.GwtDefinition')
.addEventListener('mousedown', handleMouseDown, false);
document.getElementById('embed-org.oscim.gdx.GwtDefinition')
.addEventListener('mouseup', handleMouseUp, false);
</script>
</html>