Transparent background in spritesheet animation

  ... in the unlikely case you discovered a bug, post it here.

Transparent background in spritesheet animation

Postby sanoopsam » Mon Jun 02, 2014 8:37 am

I have successfully displayed an animation by using spritesheet(generated using TexturePacker). But when I set transparent background for the scene,it is not working! its displayed with black background. But for the other colors it is displaying the specified colors.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. m_Scene.setBackground(new Background(Color.RED));//displayed with red Bg
  2.  
  3. m_Scene.setBackground(new Background(Color.TRANSPARENT));//displayed with black Bg
  4.  
Parsed in 0.012 seconds, using GeSHi 1.0.8.4



please check below link to see the output:

https://docs.google.com/file/d/0BwMxWp4 ... NoTlk/edit
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. m_Scene.setBackground(new Background(Color.RED)); //displayed with red Bg
  2.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4



https://docs.google.com/file/d/0BwMxWp4 ... o2Ums/edit
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. m_Scene.setBackground(new Background(Color.TRANSPARENT));//displayed with black Bg
  2.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4







What could be the reason for this issue? can anyone help me to solve this ?


Below is my full source code



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class TexturePackerExample extends SimpleBaseGameActivity {
  2.         private static final int CAMERA_WIDTH = 250;
  3.         private static final int CAMERA_HEIGHT = 320;
  4.  
  5.         private Camera m_Camera;
  6.         private Scene m_Scene;
  7.  
  8.         // private BitmapTextureAtlas texBanana;
  9.         private TiledTextureRegion mTiledTextureRegion;
  10.         private AnimatedSprite mAnimatedSprite;
  11.  
  12.         /*
  13.          * private static int SPR_COLUMN = 2; private static int SPR_ROWS = 7;
  14.          */
  15.  
  16.         @Override
  17.         public EngineOptions onCreateEngineOptions() {
  18.                 m_Camera = new Camera(-5, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
  19.                
  20.                 EngineOptions en = new EngineOptions(false,
  21.                                 ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(
  22.                                                 CAMERA_WIDTH, CAMERA_HEIGHT), m_Camera);
  23.  
  24.                 return en;
  25.         }
  26.  
  27.         @Override
  28.         protected Scene onCreateScene() {
  29.  
  30.                 this.m_Scene = new Scene();
  31.                 this.m_Scene.setBackgroundEnabled(true);
  32.  
  33.                 // this.m_Scene.setBackground(new Background(Color.TRANSPARENT)); //This is NOT working   giving   me black background
  34.  
  35.                 this.m_Scene.setBackground(new Background(Color.RED));// This is working
  36.  
  37.  
  38.                 mTiledTextureRegion = getTiledTextureFromPack("sample");
  39.                 mAnimatedSprite = new AnimatedSprite(0, 0, mTiledTextureRegion,
  40.                                 this.getVertexBufferObjectManager());
  41.  
  42.                 this.m_Scene.attachChild(mAnimatedSprite);
  43.  
  44.                 mAnimatedSprite.animate(160);
  45.  
  46.                 return this.m_Scene;
  47.         }
  48. }
  49.  
Parsed in 0.013 seconds, using GeSHi 1.0.8.4
sanoopsam
 
Posts: 2
Joined: Wed May 28, 2014 8:53 am

Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests