无法加载文件:Pictures / Saved Pictures / AA16.png-tsx文件问题

时间:2019-10-12 09:11:56

标签: android-studio libgdx

我使用Tiled制作了一个tilemap,然后将其及其tsx文件复制并粘贴到了Android资源中,但是由于某种原因,该东西无法将png文件加载到我的tsx文件中。

这是我渲染东西的代码:

public class PlayScreen implements Screen {
    private GenericGame game;
    private OrthographicCamera gamecam;
    private Viewport gamePort;
    private Hud hud;
    private TmxMapLoader mapLoader;
    private TiledMap map;
    private OrthoCachedTiledMapRenderer renderer;




public PlayScreen(GenericGame game){
    this.game = game;
    gamecam = new OrthographicCamera();
    gamePort = new FitViewport(GenericGame.V_WIDTH, GenericGame.V_HEIGHT, gamecam);
    hud = new Hud(game.batch);


    mapLoader = new TmxMapLoader();


    //Put The tiledmap in here vib.
    map = mapLoader.load("Generic Map Box 2.tmx");

            renderer = new OrthoCachedTiledMapRenderer(map);
    gamecam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2,0 );


}

    @Override
    public void show() {

    }
    public void HandleInput(float dt){
if(Gdx.input.isTouched())
    gamecam.position.x += 100 *dt;


    }


public void update(float dt){
    HandleInput(dt);

    gamecam.update();
    renderer.setView(gamecam);

}
    @Override
    public void render(float delta) {
    update(delta);

    // makes screen black
    Gdx.gl.glClearColor(0,0,0,1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    renderer.render();

    game.batch.setProjectionMatrix(hud.stage.getCamera().combined);
    hud.stage.draw();


    }

    @Override
    public void resize(int width, int height) {
        gamePort.update(width,height);
    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void hide() {

    }

    @Override
    public void dispose() {

    }
}

它应该已经在窗口中显示了我的tiledmap,但是它无法为tileset加载任何tile。

0 个答案:

没有答案