Search in sources :

Example 1 with ClasspathFileHandleResolver

use of com.badlogic.gdx.assets.loaders.resolvers.ClasspathFileHandleResolver in project high-flyer by sangngh.

the class AbstractLevel method init.

protected void init() {
    camera = new OrthographicCamera();
    camera.setToOrtho(false, game.getSettings().getWindowWidth(), game.getSettings().getWindowHeight());
    camera.update();
    final String tiledMapPath = "data/screens/" + getLevelMap();
    assetManager = new AssetManager();
    assetManager.setLoader(TiledMap.class, new TmxMapLoader(new ClasspathFileHandleResolver()));
    assetManager.load(tiledMapPath, TiledMap.class);
    assetManager.load(SPRITES, Texture.class);
    assetManager.finishLoading();
    TiledMap map = assetManager.get(tiledMapPath);
    renderer = new OrthogonalTiledMapRenderer(map);
    player = new Player(this.game, getSpriteTextures(), map.getLayers(), 480, 1045);
    player.setPosition(0 * TILE_SIZE, 6 * TILE_SIZE);
    player.rotate(90);
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/fonts/Amatic-Bold.ttf"));
    FreeTypeFontParameter parameter = new FreeTypeFontParameter();
    parameter.size = 40;
    // parameter.characters = "Score: "+game.getState().getScore();
    bitMapFontName = generator.generateFont(parameter);
    generator.dispose();
}
Also used : OrthogonalTiledMapRenderer(com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer) TmxMapLoader(com.badlogic.gdx.maps.tiled.TmxMapLoader) Player(com.relic.highflyer.sprites.Player) AssetManager(com.badlogic.gdx.assets.AssetManager) FreeTypeFontParameter(com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter) OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) ClasspathFileHandleResolver(com.badlogic.gdx.assets.loaders.resolvers.ClasspathFileHandleResolver) TiledMap(com.badlogic.gdx.maps.tiled.TiledMap)

Aggregations

AssetManager (com.badlogic.gdx.assets.AssetManager)1 ClasspathFileHandleResolver (com.badlogic.gdx.assets.loaders.resolvers.ClasspathFileHandleResolver)1 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)1 FreeTypeFontParameter (com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter)1 TiledMap (com.badlogic.gdx.maps.tiled.TiledMap)1 TmxMapLoader (com.badlogic.gdx.maps.tiled.TmxMapLoader)1 OrthogonalTiledMapRenderer (com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer)1 Player (com.relic.highflyer.sprites.Player)1