Advertisement
Guest User

Untitled

a guest
Jul 19th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.56 KB | None | 0 0
  1. public class ResourceManager {
  2.  
  3.     // ====================================================
  4.     // CONSTANTS
  5.     // ====================================================
  6.     private static final ResourceManager INSTANCE = new ResourceManager();
  7.  
  8.    
  9.     // ================= References =================//
  10.     private Engine mEngine;
  11.    
  12.  
  13.     // ================= Splash =================//
  14.     public ITextureRegion textureRegionSplash;
  15.  
  16.     // ================= Main Menu =================//
  17.     public ITextureRegion textureRegionMenuBackground;
  18.     public ITextureRegion textureRegionMenuNewGame;
  19.     public ITextureRegion textureRegionMenuQuit;
  20.  
  21.     public ResourceManager() {
  22.         // TODO Auto-generated constructor stub
  23.     }
  24.  
  25.     public static ResourceManager getInstance() {
  26.         return INSTANCE;
  27.     }
  28.  
  29.     // =============== setters ===============//
  30.     public void setmEngine(Engine mEngine) {
  31.         this.mEngine = mEngine;
  32.     }
  33.  
  34.     // =============== getters ===============//
  35.     public Engine getmEngine() {
  36.         return mEngine;
  37.     }
  38.  
  39.     // =============== LOAD TEXTURES (MainMenu) ===============//
  40.     public void LoadMainMenu(Context context) {
  41.         BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/menu/");
  42.  
  43.         BuildableBitmapTextureAtlas texture = new BuildableBitmapTextureAtlas(
  44.                 mEngine.getTextureManager(), CONST.WIDTH, CONST.HEIGHT);
  45.  
  46.         textureRegionMenuNewGame = BitmapTextureAtlasTextureRegionFactory
  47.                 .createFromAsset(texture, context.getAssets(),
  48.                         context.getString(R.string.file_menu_new));
  49.  
  50.         textureRegionMenuQuit = BitmapTextureAtlasTextureRegionFactory
  51.                 .createFromAsset(texture, context.getAssets(),
  52.                         context.getString(R.string.file_menu_quit));
  53.  
  54.         try {
  55.             texture.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(
  56.                     0, 1, 4));
  57.             texture.load();
  58.         } catch (TextureAtlasBuilderException e) {
  59.  
  60.             e.printStackTrace();
  61.         }
  62.  
  63.     }
  64.  
  65.     // =============== LOAD TEXTURES (Splash) ===============//
  66.     public void LoadSplash(Context context) {
  67.         BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
  68.  
  69.         BuildableBitmapTextureAtlas texture = new BuildableBitmapTextureAtlas(
  70.                 mEngine.getTextureManager(), CONST.WIDTH, CONST.HEIGHT);
  71.  
  72.         textureRegionSplash = BitmapTextureAtlasTextureRegionFactory
  73.                 .createFromAsset(texture, context.getAssets(),
  74.                         context.getString(R.string.file_splash));
  75.  
  76.         try {
  77.             texture.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(
  78.                     0, 1, 4));
  79.             texture.load();
  80.         } catch (TextureAtlasBuilderException e) {
  81.             e.printStackTrace();
  82.         }
  83.     }
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement