use of com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver in project libgdx by libgdx.
the class TiledMapAssetManagerTest method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
assetManager = new AssetManager();
assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
assetManager.load("data/maps/tiled/isometric_grass_and_water.tmx", TiledMap.class);
assetManager.finishLoading();
map = assetManager.get("data/maps/tiled/isometric_grass_and_water.tmx");
renderer = new IsometricTiledMapRenderer(map, 1f / 64f);
String mapCustomValue = map.getProperties().get(MAP_PROPERTY_NAME, String.class);
Gdx.app.log("TiledMapAssetManagerTest", "Property : " + MAP_PROPERTY_NAME + ", Value : " + mapCustomValue);
if (!MAP_PROPERTY_VALUE.equals(mapCustomValue)) {
throw new RuntimeException("Failed to get map properties");
}
boolean boolCustomValue = map.getProperties().get(BOOL_PROPERTY_NAME, Boolean.class);
Gdx.app.log("TiledMapAssetManagerTest", "Property : " + BOOL_PROPERTY_NAME + ", Value : " + boolCustomValue);
if (boolCustomValue != BOOL_PROPERTY_VALUE) {
throw new RuntimeException("Failed to get boolean map properties");
}
int intCustomValue = map.getProperties().get(INT_PROPERTY_NAME, Integer.class);
Gdx.app.log("TiledMapAssetManagerTest", "Property : " + INT_PROPERTY_NAME + ", Value : " + intCustomValue);
if (intCustomValue != INT_PROPERTY_VALUE) {
throw new RuntimeException("Failed to get int map properties");
}
float floatCustomValue = map.getProperties().get(FLOAT_PROPERTY_NAME, Float.class);
Gdx.app.log("TiledMapAssetManagerTest", "Property : " + FLOAT_PROPERTY_NAME + ", Value : " + floatCustomValue);
if (floatCustomValue != FLOAT_PROPERTY_VALUE) {
throw new RuntimeException("Failed to get float map properties");
}
TiledMapTileSet tileset = map.getTileSets().getTileSet(0);
String tilesetCustomValue = tileset.getProperties().get(TILESET_PROPERTY_NAME, String.class);
if (!TILESET_PROPERTY_VALUE.equals(tilesetCustomValue)) {
throw new RuntimeException("Failed to get tileset properties");
}
TiledMapTile tile = tileset.getTile(1);
String tileCustomValue = tile.getProperties().get(TILE_PROPERTY_NAME, String.class);
if (!TILE_PROPERTY_VALUE.equals(tileCustomValue)) {
throw new RuntimeException("Failed to get tile properties");
}
MapLayer layer = map.getLayers().get(0);
String layerCustomValue = layer.getProperties().get(LAYER_PROPERTY_NAME, String.class);
if (!LAYER_PROPERTY_VALUE.equals(layerCustomValue)) {
throw new RuntimeException("Failed to get layer properties");
}
}
use of com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver in project libgdx by libgdx.
the class TiledMapAtlasAssetManagerTest method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
AtlasTiledMapLoaderParameters params = new AtlasTiledMapLoaderParameters();
params.forceTextureFilters = true;
params.textureMinFilter = TextureFilter.Linear;
params.textureMagFilter = TextureFilter.Linear;
assetManager = new AssetManager();
assetManager.setErrorListener(new AssetErrorListener() {
@Override
public void error(AssetDescriptor asset, Throwable throwable) {
errorMessage = throwable.getMessage();
}
});
assetManager.setLoader(TiledMap.class, new AtlasTmxMapLoader(new InternalFileHandleResolver()));
assetManager.load(fileName, TiledMap.class);
}
use of com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver in project libgdx by libgdx.
the class TiledMapPackerTestRender method create.
@Override
public void create() {
atlasTmxMapLoader = new AtlasTmxMapLoader(new InternalFileHandleResolver());
params = new AtlasTmxMapLoader.AtlasTiledMapLoaderParameters();
params.generateMipMaps = false;
params.convertObjectToTileSpace = false;
params.flipY = true;
viewport = new FitViewport(WORLD_WIDTH, WORLD_HEIGHT);
cam = (OrthographicCamera) viewport.getCamera();
map = atlasTmxMapLoader.load(TMX_LOC, params);
mapRenderer = new OrthogonalTiledMapRenderer(map, UNIT_SCALE);
}
use of com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver in project RubeLoader by tescott.
the class RubeLoaderTest method initiateSceneLoad.
/**
* Kicks off asset manager if selected...
*
*/
private void initiateSceneLoad() {
if (mUseAssetManager) {
// kick off asset manager operations...
mAssetManager = new AssetManager();
mAssetManager.setLoader(RubeScene.class, new RubeSceneAsyncLoader(new InternalFileHandleResolver()));
// kick things off..
mAssetManager.load(RUBE_SCENE_FILE_LIST[mRubeFileList][mRubeFileIndex], RubeScene.class);
}
mNextState = GAME_STATE.LOADING;
}
Aggregations