Package dwlab.shapes

Examples of dwlab.shapes.Shape


   *
   * @see #clone example
   */ 
  public Sprite lastCollidedSpriteOf( Layer layer ) {
    for ( Iterator<Shape> it = layer.children.descendingIterator(); it.hasNext(); ) {
      Shape shape = it.next();
      if( shape != this ) {
        Sprite collided = shape.layerLastSpriteCollision( this );
        if( collided != null ) return collided;
      }
    }
    return null;
  }
View Full Code Here


    public static double bulletvelocity = 10.0;
    public static Layer bullets = new Layer();
   
   
    public static Bullet create() {
      Shape pLayer = ButtonActionExample.instance.pLayer;
      Bullet bullet = new Bullet();
      bullet.jumpTo( pLayer );
      bullet.setDiameter( 0.25 );
      bullet.shapeType = ShapeType.oval;
      bullet.angle = pLayer.directionTo( cursor );
      bullet.velocity = bulletvelocity;
      bullet.visualizer.set( "7FFFBF" );
      bullets.addLast( bullet );
      return bullet;
    }
View Full Code Here

  private static Vector serviceVector01 = new Vector();
  private static Vector serviceVector10 = new Vector();
  private static Vector serviceVector11 = new Vector();
 
  public static void getEscribedRectangle( double minX, double minY, double maxX, double maxY, Margins result ) {
    Shape viewport = Camera.current.viewport;
    Camera.current.screenToField( viewport.leftX(), viewport.topY(), serviceVector00 );
    Camera.current.screenToField( viewport.rightX(), viewport.topY(), serviceVector10 );
    Camera.current.screenToField( viewport.leftX(), viewport.bottomY(), serviceVector01 );
    Camera.current.screenToField( viewport.rightX(), viewport.bottomY(), serviceVector11 );
    result.min.x = Math.min( Math.min( serviceVector00.x - minX, serviceVector10.x + maxX ),
        Math.min( serviceVector01.x - minX, serviceVector11.x + maxX ) );
    result.min.y = Math.min( Math.min( serviceVector00.y - minY, serviceVector10.y - minY ),
        Math.min( serviceVector01.y + maxY, serviceVector11.y + maxY ) );
    result.max.x = Math.max( Math.max( serviceVector00.x - minX, serviceVector10.x + maxX ),
View Full Code Here

  @Override
  public void act() {
    if( active ) {
      super.act();
      for ( Iterator<Shape> it = children.iterator(); it.hasNext(); ) {
        Shape obj = it.next();
        if( obj.active ) {
          if( debug ) {
            Project.spriteActed = false;
            obj.act();
            if( obj.toSprite() != null && ! Project.spriteActed ) Project.spritesActed += 1;
          } else {
            obj.act();
          }
        }
      }
    }
  }
View Full Code Here

  /**
   * Sets the bounds of layer to given shape.
   */
  public void setBounds( Shape shape ) {
    if( bounds == null ) {
      bounds = new Shape();
      bounds.visualizer = null;
    }
    bounds.jumpTo( shape );
    bounds.setSizeAs( shape );
  }
View Full Code Here

  @Override
  public Shape findShape( String parameterName, String parameterValue ) {
    if( getParameter( parameterName ).equals( parameterValue ) || parameterName.isEmpty() ) return this;
    for( Shape childShape: children ) {
      Shape shape = childShape.findShape( parameterName, parameterValue );
      if( shape != null ) return shape;
    }
    return null;
  }
View Full Code Here

  @Override
  public Shape findShape( Class shapeClass ) {
    if( getClass() == shapeClass ) return this;
    for( Shape childShape: children ) {
      Shape shape = childShape.findShape( shapeClass );
      if( shape != null ) return shape;
    }
    return null;
  }
View Full Code Here

  }


  @Override
  public Shape findShape( String parameterName, String parameterValue, Class shapeClass ) {
    Shape shape = super.findShape( parameterName, parameterValue, shapeClass );
    if( shape != null ) return shape;
    for( Shape childShape: children ) {
      shape = childShape.findShape( parameterName, parameterValue, shapeClass );
      if( shape != null ) return shape;
    }
View Full Code Here

 
  @Override
  public boolean insert( Shape shape, Shape pivotShape, Relativity relativity ) {
    for ( ListIterator<Shape> it = children.listIterator(); it.hasNext(); ) {
      int index = it.nextIndex();
      Shape childShape = it.next();
      if( childShape == pivotShape ) {
        if( relativity == Relativity.AFTER ) index++;
        if( relativity == Relativity.INSTEAD_OF ) it.remove();
        children.set( index, shape );
        return true;
      } else {
        if( childShape.insert( shape, pivotShape, relativity ) ) return true;
      }
    }
    return false;
  }
View Full Code Here

 
  @Override
  public boolean insert( Collection<Shape> shapes, Shape pivotShape, Relativity relativity ) {
    for ( ListIterator<Shape> it = children.listIterator(); it.hasNext(); ) {
      int index = it.nextIndex();
      Shape childShape = it.next();
      if( childShape == pivotShape ) {
        if( relativity == Relativity.AFTER ) index++;
        if( relativity == Relativity.INSTEAD_OF ) it.remove();
        children.addAll( index, shapes );
        return true;
      } else {
        if( childShape.insert( shapes, pivotShape, relativity ) ) return true;
      }
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of dwlab.shapes.Shape

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.