de.rico.adventure.entity
Class EntityDistanceToCameraComparator

java.lang.Object
  extended by de.rico.adventure.entity.EntityDistanceToCameraComparator
All Implemented Interfaces:
java.util.Comparator<AbstractEntity>

public class EntityDistanceToCameraComparator
extends java.lang.Object
implements java.util.Comparator<AbstractEntity>

This is a comparator class that can be used to compare the distances to the camera of two entities. Because this comparator uses only the center points of the entities and not their expansion into the world to perform the sorting, the result are not garanteed to be correct in any case. This is just some kind of rough sorting.

Author:
Frank Bruns

Constructor Summary
EntityDistanceToCameraComparator()
           
 
Method Summary
 int compare(AbstractEntity ent1, AbstractEntity ent2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

EntityDistanceToCameraComparator

public EntityDistanceToCameraComparator()
Method Detail

compare

public int compare(AbstractEntity ent1,
                   AbstractEntity ent2)
Specified by:
compare in interface java.util.Comparator<AbstractEntity>