Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. public class Assets implements Disposable, AssetErrorListener {
  2.  
  3. public static final Assets instance = new Assets();
  4.  
  5. private AssetManager assetManager;
  6.  
  7. public AssetPlayItems playItems;
  8.  
  9. public Skin skinGameUI;
  10.  
  11. public void initQueue (AssetManager assetManager) {
  12. this.assetManager = assetManager;
  13. // set asset manager error handler
  14. assetManager.setErrorListener(this);
  15. // load texture atlas
  16. assetManager.load(Constants.TEXTURE_PLAY_GAME, TextureAtlas.class);
  17.  
  18.  
  19. //load skins
  20. assetManager.load(Constants.SKIN_GAME_UI, Skin.class, new SkinLoader.SkinParameter(Constants.TEXTURE_GAME_UI));
  21.  
  22. //load spine
  23. assetManager.load(Constants.SKELETON_DATA, SkeletonData.class);
  24. assetManager.load(Constants.TEXTURE, TextureAtlas.class);
  25.  
  26. }
  27.  
  28. public void get(){
  29.  
  30. assetManager.finishLoading();
  31. TextureAtlas atlasPlayMain = assetManager.get(Constants.TEXTURE_PLAY_GAME);
  32.  
  33. skinGameUI = assetManager.get(Constants.SKIN_GAME_UI);
  34.  
  35. TextureAtlas atlas = assetManager.get(Constants.TEXTURE);
  36. //SkeletonData skeletonData = assetManager.get(Constants.SKELETON_DATA);
  37.  
  38. // enable texture filtering for pixel smoothing
  39. for (Texture t : atlasPlayMain.getTextures()) {
  40. t.setFilter(TextureFilter.Linear, TextureFilter.Linear);
  41. }
  42.  
  43. playItems = new AssetPlayItems(atlasPlayMain);
  44. }
  45.  
  46.  
  47. public class AssetPlayItems {
  48.  
  49. public final AtlasRegion levelBackground;
  50.  
  51. public AssetPlayItems (TextureAtlas atlas) {
  52.  
  53. levelBackground = atlas.findRegion("background");
  54.  
  55. }
  56. }
  57.  
  58.  
  59.  
  60. @Override
  61. public void dispose() {
  62. assetManager.dispose();
  63. }
  64.  
  65. @Override
  66. public void error(AssetDescriptor asset, Throwable throwable) {
  67.  
  68. }
  69. }
  70.  
  71. assetManager.load(Constants.SKELETON_DATA_DIGGI, SkeletonData.class);
  72.  
  73. exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: No loader for type: SkeletonData
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement