Skip to main content
deleted 8 characters in body
Source Link
petervaz
  • 1k
  • 3
  • 13
  • 31

In the game I'm developing I'm using a centralized AssetManager, which will hold the references and automatically dispose them. I just need to load the pack file and get the TextureAtlas from it. (or the texture if you are using single images instead of packs)

TextureAtlas atlas = game.assets.get("filename.pack", TextureAtlas.class); jewelSprite = new JewelSprite(jewelType, atlas.findRegion(nameMap.get(jewelType"textureName")), game); // use `AtlasRegion` instead of `Texture` 

Check the first link for a nice overview of the AssetManager. You don't need to pack the textures but it is recommended for performance.

In the game I'm developing I'm using a centralized AssetManager, which will hold the references and automatically dispose them. I just need to load the pack file and get the TextureAtlas from it. (or the texture if you are using single images instead of packs)

TextureAtlas atlas = game.assets.get("filename.pack", TextureAtlas.class); jewelSprite = new JewelSprite(jewelType, atlas.findRegion(nameMap.get(jewelType)), game); // use `AtlasRegion` instead of `Texture` 

Check the first link for a nice overview of the AssetManager. You don't need to pack the textures but it is recommended for performance.

In the game I'm developing I'm using a centralized AssetManager, which will hold the references and automatically dispose them. I just need to load the pack file and get the TextureAtlas from it. (or the texture if you are using single images instead of packs)

TextureAtlas atlas = game.assets.get("filename.pack", TextureAtlas.class); jewelSprite = new JewelSprite(jewelType, atlas.findRegion("textureName")), game); // use `AtlasRegion` instead of `Texture` 

Check the first link for a nice overview of the AssetManager. You don't need to pack the textures but it is recommended for performance.

Source Link
petervaz
  • 1k
  • 3
  • 13
  • 31

In the game I'm developing I'm using a centralized AssetManager, which will hold the references and automatically dispose them. I just need to load the pack file and get the TextureAtlas from it. (or the texture if you are using single images instead of packs)

TextureAtlas atlas = game.assets.get("filename.pack", TextureAtlas.class); jewelSprite = new JewelSprite(jewelType, atlas.findRegion(nameMap.get(jewelType)), game); // use `AtlasRegion` instead of `Texture` 

Check the first link for a nice overview of the AssetManager. You don't need to pack the textures but it is recommended for performance.