gdx: pass TileSource to GdxMap constructor
This commit is contained in:
@@ -4,18 +4,23 @@ import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.gdx.GdxMap;
|
||||
import org.oscim.tilesource.TileSource;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
|
||||
public class GwtGdxMap extends GdxMap {
|
||||
|
||||
public GwtGdxMap(TileSource tileSource) {
|
||||
super(tileSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
CanvasAdapter.g = GwtCanvasAdapter.INSTANCE;
|
||||
GLAdapter.g = (GL20)Gdx.graphics.getGL20();
|
||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
||||
//GLAdapter.NON_PREMUL_CANVAS = true;
|
||||
|
||||
//GLAdapter.NON_PREMUL_CANVAS = true;
|
||||
//Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||
|
||||
super.create();
|
||||
|
||||
@@ -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;
|
||||
}-*/;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user