html: GwtApplication cleanup + formatting

This commit is contained in:
Hannes Janetzek 2013-07-01 04:15:37 +02:00
parent ead0594d81
commit 7d225aabba

View File

@ -109,16 +109,6 @@ public abstract class GwtApplication implements EntryPoint, Application {
} }
} }
// initialize SoundManager2
//SoundManager.init(GWT.getModuleBaseURL(), 9);
// wait for soundmanager to load, this is fugly, but for
// some reason the ontimeout and onerror callbacks are never
// called (function instanceof Function fails, wtf JS?).
new Timer() {
@Override
public void run() {
//if (SoundManager.ok()) {
final PreloaderCallback callback = getPreloaderCallback(); final PreloaderCallback callback = getPreloaderCallback();
preloader = new Preloader(); preloader = new Preloader();
preloader.preload("assets.txt", new PreloaderCallback() { preloader.preload("assets.txt", new PreloaderCallback() {
@ -136,10 +126,6 @@ public abstract class GwtApplication implements EntryPoint, Application {
} }
} }
}); });
cancel();
//}
}
}.scheduleRepeating(100);
} }
private void setupLoop() { private void setupLoop() {
@ -167,7 +153,7 @@ public abstract class GwtApplication implements EntryPoint, Application {
this.net = new GwtNet(); this.net = new GwtNet();
Gdx.net = this.net; Gdx.net = this.net;
final double pixelRatio = GwtGraphics.getDevicePixelRatioJSNI(); final double pixelRatio = GwtGraphics.getDevicePixelRatioJSNI();
consoleLog(">>>> " + config.width + "x"+ config.height + " ratio " + pixelRatio); consoleLog("> " + config.width + "x" + config.height + " ratio:" + pixelRatio);
// tell listener about app creation // tell listener about app creation
try { try {
@ -187,13 +173,13 @@ public abstract class GwtApplication implements EntryPoint, Application {
public void run() { public void run() {
try { try {
graphics.update(); graphics.update();
if (Gdx.graphics.getWidth() != lastWidth if (graphics.getWidth() != lastWidth
|| Gdx.graphics.getHeight() != lastHeight) { || graphics.getHeight() != lastHeight) {
GwtApplication.this.listener.resize(
(int)(Gdx.graphics.getWidth()),
(int)(Gdx.graphics.getHeight()));
lastWidth = graphics.getWidth(); lastWidth = graphics.getWidth();
lastHeight = graphics.getHeight(); lastHeight = graphics.getHeight();
GwtApplication.this.listener.resize(lastWidth, lastHeight);
//Gdx.gl.glViewport(0, 0, lastWidth, lastHeight); //Gdx.gl.glViewport(0, 0, lastWidth, lastHeight);
} }
runnablesHelper.addAll(runnables); runnablesHelper.addAll(runnables);