Android Open Source - Flumpgdx Flump Display Bundle






From Project

Back to project page Flumpgdx.

License

The source code is released under:

Copyright (c) 2014 Daniyal Khan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softw...

If you think the Android project Flumpgdx listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.flumpgdx.display;
/*  ww w . ja  va 2s  . co m*/
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Matrix3;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.flumpgdx.library.FlumpLayer;

public abstract class FlumpDisplayBundle extends FlumpDisplay {

  private final Array<FlumpDisplay> displayLayers;
  
  public FlumpDisplayBundle(FlumpLayer layer) {
    super(layer);
    displayLayers = new Array<FlumpDisplay>();
  }
  
  @Override
  protected void applyTransformation(Matrix3 transformation) {
    for (FlumpDisplay display: displayLayers) {
      display.applyTransformation(transformation);
    }
  }
  
  @Override
  protected void applyTranslation(Vector2 translation) {
    for (FlumpDisplay display: displayLayers) {
      display.applyTranslation(translation);
    }
  }
  
  @Override
  public int maxFrameCount() {
    if (displayLayers == null || displayLayers.size == 0) return 0;
    int maxFrameCount = displayLayers.get(0).maxFrameCount();
    for (FlumpDisplay display: displayLayers) {
      if (display.maxFrameCount() > maxFrameCount)
        maxFrameCount = display.maxFrameCount();
    }
    return maxFrameCount;
  }

  public void addDisplay(FlumpDisplay display) {
    displayLayers.add(display);
  }

  @Override
  void update(int frame) {
    for (FlumpDisplay display: displayLayers) {
      display.update(frame);
      if (reference != null) {
        System.out.println(reference);
        getAttributes(this, 0);
        
        //TODO check that this still works
        pos[0].set(xPivot + xLoc, -xPivot + yLoc);
        pos[1].set(xPivot + xLoc, -xPivot + yLoc);
        pos[2].set(xPivot + xLoc, -xPivot + yLoc);
        pos[3].set(xPivot + xLoc, -xPivot + yLoc);
        
//        bindToPivots(display);
//        display.x1 += xLoc;
//        display.y1 += yLoc;
//        display.x2 += xLoc;
//        display.y2 += yLoc;
//        display.x3 += xLoc;
//        display.y3 += yLoc;
//        display.x4 += xLoc;
//        display.y4 += yLoc;
      }
    }
  }

  @Override
  void draw(SpriteBatch batch) {
    for (FlumpDisplay display: displayLayers) {
      display.draw(batch);
    }
  }
  
}




Java Source Code List

com.flumpgdx.FlumpGDX.java
com.flumpgdx.IOSLauncher.java
com.flumpgdx.android.AndroidLauncher.java
com.flumpgdx.client.GwtLauncher.java
com.flumpgdx.desktop.DesktopLauncher.java
com.flumpgdx.display.FlumpAnimation.java
com.flumpgdx.display.FlumpDisplayBundle.java
com.flumpgdx.display.FlumpDisplayTexture.java
com.flumpgdx.display.FlumpDisplay.java
com.flumpgdx.display.TextureCache.java
com.flumpgdx.library.FlumpAtlas.java
com.flumpgdx.library.FlumpKeyFrame.java
com.flumpgdx.library.FlumpLayer.java
com.flumpgdx.library.FlumpLibraryFile.java
com.flumpgdx.library.FlumpMovie.java
com.flumpgdx.library.FlumpTextureGroup.java
com.flumpgdx.library.FlumpTextureRegion.java
com.flumpgdx.library.MovieMaker.java