Esto se usa para explotar las texturas que ha empaquetado el TexturePacker y poderlas pintar con el programa.
Ejemplo de uso:
TextureAtlas atlas;
atlas = new TextureAtlas(Gdx.files.internal("packedimages/pack"));
Lo que hace TextureAtlas es leer el fichero de texto "pack" y cargar todas las paginas de imagenes que el "pack" referencia.
Y luego para explotarlo y pintar tenemos varias opciones, podemos usar TextureAtlas.AtlasRegions que son TextureRegions que es un trozo de textura.
AtlasRegion region = atlas.findRegion("imagename");//findRegion ES MUY LENTO es mejor guardar el valor devuelto.
The coordinate system used has its origin in the upper left corner with the x-axis pointing to the right and the y axis pointing downwards."
Otra opción es usar Sprites.
Sprite sprite = atlas.createSprite("otherimagename");//instancia un nuevo sprite
Si destruimos el textureAtlas tambien nos cargamos todas las paginas de texturas.
http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=2679
Ejemplo de uso:
TextureAtlas atlas;
atlas = new TextureAtlas(Gdx.files.internal("packedimages/pack"));
Lo que hace TextureAtlas es leer el fichero de texto "pack" y cargar todas las paginas de imagenes que el "pack" referencia.
Y luego para explotarlo y pintar tenemos varias opciones, podemos usar TextureAtlas.AtlasRegions que son TextureRegions que es un trozo de textura.
AtlasRegion region = atlas.findRegion("imagename");//findRegion ES MUY LENTO es mejor guardar el valor devuelto.
The coordinate system used has its origin in the upper left corner with the x-axis pointing to the right and the y axis pointing downwards."
Otra opción es usar Sprites.
Sprite sprite = atlas.createSprite("otherimagename");//instancia un nuevo sprite
Si destruimos el textureAtlas tambien nos cargamos todas las paginas de texturas.
http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=2679

No hay comentarios:
Publicar un comentario