refactor backend Adapter classes

This commit is contained in:
Hannes Janetzek
2014-03-21 21:45:33 +01:00
parent 4e4d4270db
commit 4fb3d13404
12 changed files with 46 additions and 34 deletions

View File

@@ -24,11 +24,16 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.GdxRuntimeException;
public class GdxAssetAdapter extends AssetAdapter {
public class GdxAssets extends AssetAdapter {
static String pathPrefix = "";
private GdxAssets(String path) {
pathPrefix = path;
}
@Override
public InputStream openFileAsStream(String fileName) {
FileHandle file = Gdx.files.internal("assets/" + fileName);
FileHandle file = Gdx.files.internal(pathPrefix + fileName);
if (file == null)
throw new IllegalArgumentException("missing file " + fileName);
@@ -39,4 +44,8 @@ public class GdxAssetAdapter extends AssetAdapter {
return null;
}
}
public static void init(String path) {
g = new GdxAssets(path);
}
}

View File

@@ -16,7 +16,6 @@
*/
package org.oscim.gdx;
import org.oscim.backend.AssetAdapter;
import org.oscim.core.Tile;
import org.oscim.layers.GenericLayer;
import org.oscim.layers.TileGridLayer;
@@ -51,7 +50,6 @@ public abstract class GdxMap implements ApplicationListener {
boolean mRenderRequest;
public GdxMap() {
AssetAdapter.g = new GdxAssetAdapter();
mMap = new Map() {
@Override