Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ResourceManager {
- // ====================================================
- // CONSTANTS
- // ====================================================
- private static final ResourceManager INSTANCE = new ResourceManager();
- // ================= References =================//
- private Engine mEngine;
- // ================= Splash =================//
- public ITextureRegion textureRegionSplash;
- // ================= Main Menu =================//
- public ITextureRegion textureRegionMenuBackground;
- public ITextureRegion textureRegionMenuNewGame;
- public ITextureRegion textureRegionMenuQuit;
- public ResourceManager() {
- // TODO Auto-generated constructor stub
- }
- public static ResourceManager getInstance() {
- return INSTANCE;
- }
- // =============== setters ===============//
- public void setmEngine(Engine mEngine) {
- this.mEngine = mEngine;
- }
- // =============== getters ===============//
- public Engine getmEngine() {
- return mEngine;
- }
- // =============== LOAD TEXTURES (MainMenu) ===============//
- public void LoadMainMenu(Context context) {
- BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/menu/");
- BuildableBitmapTextureAtlas texture = new BuildableBitmapTextureAtlas(
- mEngine.getTextureManager(), CONST.WIDTH, CONST.HEIGHT);
- textureRegionMenuNewGame = BitmapTextureAtlasTextureRegionFactory
- .createFromAsset(texture, context.getAssets(),
- context.getString(R.string.file_menu_new));
- textureRegionMenuQuit = BitmapTextureAtlasTextureRegionFactory
- .createFromAsset(texture, context.getAssets(),
- context.getString(R.string.file_menu_quit));
- try {
- texture.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(
- 0, 1, 4));
- texture.load();
- } catch (TextureAtlasBuilderException e) {
- e.printStackTrace();
- }
- }
- // =============== LOAD TEXTURES (Splash) ===============//
- public void LoadSplash(Context context) {
- BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
- BuildableBitmapTextureAtlas texture = new BuildableBitmapTextureAtlas(
- mEngine.getTextureManager(), CONST.WIDTH, CONST.HEIGHT);
- textureRegionSplash = BitmapTextureAtlasTextureRegionFactory
- .createFromAsset(texture, context.getAssets(),
- context.getString(R.string.file_splash));
- try {
- texture.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(
- 0, 1, 4));
- texture.load();
- } catch (TextureAtlasBuilderException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement