In the old libgdx map api, they used to have
map = TiledLoader.createMap(Gdx.files.internal("maps/testmap.tmx"));
atlas = new TileAtlas(map, Gdx.files.internal("maps"));
tileMapRenderer = new TileMapRenderer(map, atlas, 8, 8);
However in the new libgdx the rule changes, to load a tilemap there is no longer needed to use map packer first. You can directly use the .tmx file with the tileset png. Something like following will work, and then call render.
TiledMap map = new TmxMapLoader().load("maps/testmap.tmx");
My question is the original tileselt.png that used to generate the .tmx file, it's size is not power of two. So I still have to either use Texture packer or a map packer to pack it for using.
I could not successfully associate the packed file with the .tmx;
Is there anyway to approach this issue?
Thanks
They do not need to be power of two. If you have Problems with it like you get the power of two error set
Texture.setEnforcePotImages(false);inside of your MainClass.You do not need the packer anymore so i think you cant associate the packer to the tmx file.
If you use the
TmxMapLoaderthe tilesets need to be inside of the same folder of the.tmxfile. If they are inside of an different directory you need to configure the source path inside of the.tmxfile. here is an Example:is the regular output of Tiled. If the Tileset is inside of for example config it you need to change it like this:
But it still need to be a subfolder of the path where the tmx file is.
Regards hope that may helps.