Package com.badlogic.gdx.utils

Examples of com.badlogic.gdx.utils.Bits


   * Checks if the passed entity matches this family's requirements.
   * @param entity The entity to check for matching
   * @return Whether the entity matches or not
   */
  public boolean matches(Entity entity){
    Bits entityComponentBits = entity.getComponentBits();
   
    if(entityComponentBits.isEmpty())
      return false;
   
    for (int i = all.nextSetBit(0); i >= 0; i = all.nextSetBit(i+1)){
      if(!entityComponentBits.get(i))
        return false;
    }
   
    if (!one.isEmpty() && !one.intersects(entityComponentBits)) {
      return false;
View Full Code Here


   * @param componentTypes The components to describe the family, entities must match all these components
   * @return The family
   */
  @SafeVarargs
  public static Family getFamilyFor(Class<? extends Component> ...componentTypes){
    return getFamilyFor(ComponentType.getBitsFor(componentTypes), new Bits(), new Bits());
  }
View Full Code Here

    /**
   * @param componentTypes list of component types
   * @return Bits representing the collection of components for quick comparison and matching. See {@link Family#getFamilyFor(Bits, Bits, Bits)}.
   */
  public static Bits getBitsFor(Class<? extends Component> ...componentTypes) {
    Bits bits = new Bits();

        int typesLength = componentTypes.length;
        for(int i = 0; i < typesLength; i++){
            bits.set(ComponentType.getIndexFor(componentTypes[i]));
        }
       
        return bits;
  }
View Full Code Here

   */
  public Entity(){
    components = new ObjectMap<Class<? extends Component>, Component>();
    componentsArray = new Array<Component>();
    immutableComponentsArray = new ImmutableArray<Component>(componentsArray);
    componentBits = new Bits();
    familyBits = new Bits();
    flags = 0;
   
    index = nextIndex++;
   
    componentAdded = new Signal<Entity>();
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.utils.Bits

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.