@Override protected void loadResources() { super.loadResources(); this.loadFont(); BitmapTextureAtlas bitmapTextureAtlas = new BitmapTextureAtlas( getTextureManager(), 1024, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA); textureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( bitmapTextureAtlas, this, "bulles.png", 0, 0, 10, 1); bitmapTextureAtlas.load(); BitmapTextureAtlas bitmapTextureAtlasScore = new BitmapTextureAtlas( getTextureManager(), 1024, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA); textureRegionScore = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( bitmapTextureAtlasScore, this, "background_brown.png", 0, 0, 1, 1); bitmapTextureAtlasScore.load(); BitmapTextureAtlas bitmapTextureAtlasExplosione = new BitmapTextureAtlas( getTextureManager(), 1024, 1024, TextureOptions.BILINEAR_PREMULTIPLYALPHA); textureRegionExplosion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( bitmapTextureAtlasExplosione, this, "explosion.png", 0, 0, 7, 7); bitmapTextureAtlasExplosione.load(); BitmapTextureAtlas bitmapTextureAtlasPlate = new BitmapTextureAtlas( getTextureManager(), 512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA); plateTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( bitmapTextureAtlasPlate, this, "plate.png", 0, 0, 1, 1); bitmapTextureAtlasPlate.load(); BitmapTextureAtlas bitmapTextureAtlasHeader = new BitmapTextureAtlas( getTextureManager(), 512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA); headerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( bitmapTextureAtlasHeader, this, "header_background.png", 0, 0, 1, 1); bitmapTextureAtlasHeader.load(); if (null != this.getIntent().getExtras()) animated = this.getIntent().getExtras().getBoolean("ANIMATED"); }
private void loadGameGraphics() { BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/game/"); gameTextureAtlas = new BuildableBitmapTextureAtlas( activity.getTextureManager(), 1024, 1024, TextureOptions.REPEATING_NEAREST_PREMULTIPLYALPHA); rockTop_region = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameTextureAtlas, activity, "Red_Rock_Top.png"); rockMid_region = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameTextureAtlas, activity, "Red_Rock_Middle.png"); rockOre_region = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameTextureAtlas, activity, "Ore_Rock.png"); player_region = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( gameTextureAtlas, activity, "player.png", 1, 1); dpad_region = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameTextureAtlas, activity, "Dpad_Notpressed.png"); try { this.gameTextureAtlas.build( new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 0)); this.gameTextureAtlas.load(); } catch (final TextureAtlasBuilderException e) { Debug.e(e); } }
public void loadResourePlayer() { this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 72, 128, TextureOptions.DEFAULT); this.mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( this.mBitmapTextureAtlas, this, "player.png", 0, 0, 3, 4); this.mBitmapTextureAtlas.load(); }
@Override public void onCreateResources() { // Set the texture base path BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("sprites/"); // Set the TextrueAtlas size // this.mBitmapTextureAtlas = new BitmapTextureAtlas(256, 256, TextureOptions.NEAREST); this.mBitmapTextureAtlas = new BitmapTextureAtlas(256, 256, TextureOptions.BILINEAR); this.mBitmapJumpTextureAtlas = new BitmapTextureAtlas(256, 256, TextureOptions.BILINEAR); // Set the region and specific sprite this.mMarioTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( this.mBitmapTextureAtlas, this, "mario_walk.png", 0, 0, 3, 2); this.mMarioJumpTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( this.mBitmapJumpTextureAtlas, this, "mario_jump.png", 0, 0, 1, 2); this.mEngine.getTextureManager().loadTexture(mBitmapTextureAtlas); }
public void loadSplashResources() { BitmapTextureAtlasTextureRegionFactory.setAssetBasePath( ResourceManager.AssetFolders.Images + "/" + ResourceManager.ImageFolders.Textures + "/"); splashTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 1024, 512); splashTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset( splashTextureAtlas, activity, "splash_bg.png", 0, 0); splashTextureAtlas.load(); backgroundSprite = new Sprite(0, 0, splashTextureRegion, vertexBufferObjectManager) { @Override protected void preDraw(GLState pGLState, Camera pCamera) { super.preDraw(pGLState, pCamera); pGLState.enableDither(); } }; float width = camera.getWidth(); float height = camera.getHeight(); backgroundSprite.setPosition(width / 2, height / 2); backgroundSprite.setSize(width, height); BitmapTextureAtlasTextureRegionFactory.setAssetBasePath( ResourceManager.AssetFolders.Images + "/" + ResourceManager.ImageFolders.TiledTextures + "/"); spinnerTextureAtlas = new BitmapTextureAtlas(activity.getTextureManager(), 1398, 128); spinnerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( spinnerTextureAtlas, activity, "android_loading.png", 0, 0, 8, 1); spinnerTextureAtlas.load(); spinner = new AnimatedSprite(width / 2, height / 2, spinnerTextureRegion, vertexBufferObjectManager); spinner.setZIndex(10); spinner.animate(200); FontFactory.setAssetBasePath(ResourceManager.AssetFolders.Fonts + "/"); ITexture fontTexture2 = new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR); textFont = FontFactory.createStrokeFromAsset( activity.getFontManager(), fontTexture2, activity.getAssets(), "OpenSans-Regular.ttf", 25, true, Color.WHITE, 1, Color.rgb(70, 70, 70)); textFont.load(); }
@Override protected void loadResourcesImpl() { mBgTextureRegion = AEUtils.createTextureRegionFromAssets("gfx/storm_flush_bg.png", mBaseActivity); mFont = AEUtils.createGameFont(mBaseActivity); BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); mItemTexture = new BitmapTextureAtlas(this.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR); mLocTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( mItemTexture, mBaseActivity, "item_names.png", 0, 0, 1, 3); mMessageBox = BitmapTextureAtlasTextureRegionFactory.createFromAsset( mItemTexture, mBaseActivity, "msg_storm_flush.png", 0, 80); mBgTextureRegion.getTexture().load(); mItemTexture.load(); mFont.load(); }
@Override public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws Exception { // TODO Auto-generated method stub this.mFontTexture = new BitmapTextureAtlas( this.getTextureManager(), 256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA); FontFactory.setAssetBasePath("font/"); mFont = FontFactory.createFromAsset( this.getFontManager(), this.mFontTexture, this.getAssets(), "texas.ttf", 60.0f, true, Color.BLACK); mFont.load(); BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); texBanana = new BitmapTextureAtlas( this.getTextureManager(), 256, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA); regBanana = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( texBanana, this.getAssets(), "spr_banana.png", 0, 0, SPR_COLUMN, SPR_ROWS); texBanana.load(); mMenuTexture = new BitmapTextureAtlas(this.getTextureManager(), 1024, 512, TextureOptions.BILINEAR); mMenuTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset( mMenuTexture, this.getAssets(), "menu.png", 0, 0); mMenuTexture.load(); pOnCreateResourcesCallback.onCreateResourcesFinished(); }
public TiledTextureRegion loadImageResourceTiledFromSD( String nameResource, BitmapTextureAtlas pBitmapTextureAtlas, int pTexturePositionX, int pTexturePositionY, int numColumns, int numRows) { if (BuildConfig.TEST_VERSION) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( pBitmapTextureAtlas, getActivity(), nameResource, pTexturePositionX, pTexturePositionY, numColumns, numRows); } else { String path = Environment.getExternalStorageDirectory() + "/Android/data/" + getActivity().getPackageName() + "/files/" + songName + "/gfx/" + nameResource + ".nomedia"; File tmp = new File(path); if (!tmp.exists()) { return null; } return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource( pBitmapTextureAtlas, FileBitmapTextureAtlasSource.create(tmp), pTexturePositionX, pTexturePositionY, numColumns, numRows); } }
private void loadGameGraphics() { if (gameTextureAtlas != null) { gameTextureAtlas.load(); } BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/game/"); gameTextureAtlas = new BuildableBitmapTextureAtlas( activity.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR); backgroundGameTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameTextureAtlas, activity, "background.png"); buttonOkTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameTextureAtlas, activity, "button_ok.png"); buttonNoTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameTextureAtlas, activity, "button_no.png"); lifeBarBorderTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameTextureAtlas, activity, "bar_border.png"); playerRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset( gameTextureAtlas, activity, "blackFish.png", 2, 1); try { gameTextureAtlas.build( new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(0, 0, 1)); gameTextureAtlas.load(); } catch (ITextureAtlasBuilder.TextureAtlasBuilderException e) { e.printStackTrace(); } }