Package dwlab.shapes.sprites

Examples of dwlab.shapes.sprites.Sprite


    projection.x = ( -c - b * projection.y ) / a;
    return projection;
  }
 
  public Sprite pivotProjection( Sprite pivot ) {
    return pivotProjection( pivot, new Sprite() );
  }
View Full Code Here


    pivot.x = ( c - b * pivot.y ) / a;
    return pivot;
  }
 
  public Sprite intersectionWithLine( Line line ) {
    return intersectionWithLine( line, new Sprite() );
  }
View Full Code Here

    }
    return null;
  }
 
  public Sprite intersectionWithLineSegment( Sprite lSPivot1, Sprite lSPivot2 ) {
    return intersectionWithLineSegment( lSPivot1, lSPivot2, new Sprite() );
  }
View Full Code Here

        if( sorted ) {
          double maxY = ( yy + 1 ) * cellHeight;
          while( true ) {
            double minY = 0;
            int storedX = 0;
            Sprite storedSprite = null;
            for( int xx = 0; xx <= mapX2 - mapX1; xx++ ) {
              int maskedX = xx & yMask;
              int n = xN[ xx ];
              if( n >= listSize[ maskedY ][ maskedX ] ) continue;
              Sprite sprite = lists[ maskedY ][ maskedX ][ n ];
              double y0 = sprite.getY();
              if( y0 >= maxY ) continue;
              if( storedSprite == null || y0 < minY ) {
                minY = y0;
                storedX = xx;
                storedSprite = sprite;
              }
            }
            if( storedSprite == null ) break;

            if( storedSprite.checkValue != Sprite.checkNum ) {
              if( vis != null ) {
                vis.drawUsingSprite( storedSprite, storedSprite, drawingColor );
              } else {
                storedSprite.draw( drawingColor );
              }
              storedSprite.checkValue = Sprite.checkNum;
            }

            xN[ storedX ] += 1;
          }
        } else {
          for( int xx = mapX1; xx <= mapX2; xx++ ) {
            int maskedX = xx & xMask;
            Sprite array[] = lists[ maskedY ][ maskedX ];
            for( int n = 0; n < listSize[ maskedY ][ maskedX ]; n++ ) {
              Sprite sprite = array[ n ];
              if( sprite.checkValue != Sprite.checkNum ) {
                if( vis != null ) {
                  sprite.drawUsingVisualizer( vis, drawingColor );
                } else {
                  sprite.draw( drawingColor );
                }
                sprite.checkValue = Sprite.checkNum;
              }
            }
          }
View Full Code Here

    insertSprite( sprite, true, true );
  }


  public void insertSprite( Sprite sprite, int mapX, int mapY ) {
    Sprite array[] = lists[ mapY ][ mapX ];
    int size = listSize[ mapY ][ mapX ];
    if( array.length == size ) {
      array = Arrays.copyOf( array, size * 2 );
      lists[ mapY ][ mapX ] = array;
    }
View Full Code Here

  }



  public void removeSprite( Sprite sprite, int mapX, int mapY ) {
    Sprite array[] = lists[ mapY ][ mapX ];
    int size = listSize[ mapY ][ mapX ];
    for( int n = 0; n <= size; n++ ) {
      if( array[ n ] == sprite ) {
        if( sorted ) {
          for( int m=n + 1; m <= size; m++ ) array[ m - 1 ] = array[ m ];
View Full Code Here

  }


  @Override
  public boolean insert( Shape shape, Shape pivotShape, Relativity relativity ) {
    Sprite sprite = pivotShape.toSprite();
    if( sprite == null ) return false;
    if( sprites.contains( sprite ) ) {
      sprite = shape.toSprite();
      if( sprite != null ) sprites.add( sprite );
      return true;
View Full Code Here

  }
 
 
  @Override
  public boolean insert( Collection<Shape> shapes, Shape pivotShape, Relativity relativity ) {
    Sprite sprite = pivotShape.toSprite();
    if( sprite == null ) return false;
    if( sprites.contains( sprite ) ) {
      for( Shape shape : shapes ) {
        sprite = shape.toSprite();
        if( sprite != null ) sprites.add( sprite );
View Full Code Here

  }
 

  @Override
  public Shape remove( Shape shape ) {
    Sprite sprite = shape.toSprite();
    if( sprite != null ) sprites.remove( sprite );
    return this;
  }
View Full Code Here

   * Execute this method every time you change TilesQuantity parameter.
   */
  public final void refreshTilesQuantity() {
    if( image == null ) return;
    int newTilesQuantity = image.framesQuantity();
    Sprite newCollisionSprites[][] = new Sprite[ newTilesQuantity ][];
    for( int n = 0; n < Math.min( tilesQuantity, newTilesQuantity ); n++ ) newCollisionSprites[ n ] = collisionSprites[ n ];
    collisionSprites = newCollisionSprites;
    tilesQuantity = newTilesQuantity;
    update();
  }
View Full Code Here

TOP

Related Classes of dwlab.shapes.sprites.Sprite

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.