Android Open Source - fireflies_android Depth Sort Comparator






From Project

Back to project page fireflies_android.

License

The source code is released under:

MIT License

If you think the Android project fireflies_android 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 donothingbox.game.model;
/*from   ww w  .ja  v  a  2 s  .c o m*/
import java.util.Comparator;
import donothingbox.game.view.*;

/*
 *  used to sort the Arraylist holding objects on the gameSurfaceView. 
 * 
 */

public class DepthSortComparator implements Comparator<Sprite>
{
  public int compare(Sprite a, Sprite b)
  {
      if (a.depth < b.depth)
          return -1;
  
      if (a.depth == b.depth)
      {
          if (a.depth < b.depth)
              return -1;
          if (a.depth > b.depth)
              return 1;
          return 0;
      }
  
      return 1;
  }
}




Java Source Code List

com.donothingbox.fireflies_android.CoreApp.java
com.donothingbox.fireflies_android.DynamicActivity.java
com.donothingbox.fireflies_android.GameSurfaceActivity.java
com.donothingbox.fireflies_android.MainActivity.java
donothingbox.game.controller.AudioController.java
donothingbox.game.controller.GameThread.java
donothingbox.game.controller.HUDController.java
donothingbox.game.controller.StateController.java
donothingbox.game.model.DepthSortComparator.java
donothingbox.game.utils.BitmapUtils.java
donothingbox.game.utils.Utils.java
donothingbox.game.view.CustomDrawableView.java
donothingbox.game.view.FireflySprite.java
donothingbox.game.view.GameLayout.java
donothingbox.game.view.GameSurfaceView.java
donothingbox.game.view.Sprite.java