gdx: pass TileSource to GdxMap constructor

This commit is contained in:
Hannes Janetzek
2013-07-01 04:17:53 +02:00
parent 03d2bad695
commit 1ab86f5ba8
5 changed files with 45 additions and 20 deletions

View File

@@ -2,6 +2,8 @@ package org.oscim.gdx.client;
// -draftCompile -localWorkers 2
import org.oscim.core.Tile;
import org.oscim.tilesource.TileSource;
import org.oscim.tilesource.oscimap4.OSciMap4TileSource;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
@@ -12,10 +14,11 @@ public class GwtLauncher extends GwtApplication {
@Override
public GwtApplicationConfiguration getConfig() {
GwtApplicationConfiguration cfg = new GwtApplicationConfiguration(GwtGraphics.getWindowWidthJSNI(),
GwtGraphics.getWindowHeightJSNI() );
GwtApplicationConfiguration cfg = new GwtApplicationConfiguration(
GwtGraphics.getWindowWidthJSNI(),
GwtGraphics.getWindowHeightJSNI());
cfg.stencil = true;
cfg.fps = 25;
cfg.fps = 30;
return cfg;
}
@@ -27,6 +30,14 @@ public class GwtLauncher extends GwtApplication {
else
Tile.SIZE = 360;
return new GwtGdxMap();
String url = getMapConfig("tileurl");
TileSource tileSource = new OSciMap4TileSource();
tileSource.setOption("url", url);
return new GwtGdxMap(tileSource);
}
private static native String getMapConfig(String key)/*-{
return $wnd.mapconfig && $wnd.mapconfig[key] || null;
}-*/;
}