Package java.awt

Examples of java.awt.Polygon.translate()


        @Override
        public void drawOnto(Graphics g, int x, int y, ImageObserver observer) {
            Polygon drawPoly = new Polygon(attackPoly.xpoints,
                    attackPoly.ypoints, attackPoly.npoints);
            drawPoly.translate(x, y);

            g.setColor(attackColor);
            g.fillPolygon(drawPoly);
            g.setColor(Color.gray.darker());
            g.drawPolygon(drawPoly);
View Full Code Here


            if(vel == 0) {
                return;
            }

            Polygon drawPoly = new Polygon(movePoly.xpoints, movePoly.ypoints, movePoly.npoints);
            drawPoly.translate(x, y);

            g.setColor(moveColor);
            g.fillPolygon(drawPoly);
            g.setColor(Color.gray.darker());
            g.drawPolygon(drawPoly);
View Full Code Here

  public static boolean checkCollision(FysixObject fo1, FysixObject fo2) {
    Vector2d relVel = new Vector2d();
    relVel.sub(fo1.getVelocity(), fo2.getVelocity());
    Polygon p1 = fo1.getBoundingArea();
    p1.translate((int)fo1.getPosition().x, (int)fo1.getPosition().y);
    Polygon p2 = fo2.getBoundingArea();
    p2.translate((int)fo2.getPosition().x, (int)fo2.getPosition().y);
    PolygonCollisionResult res = PolygonCollision(p1, p2, relVel);
    p1.translate((int)-fo1.getPosition().x, (int)-fo1.getPosition().y);
    p2.translate((int)-fo2.getPosition().x, (int)-fo2.getPosition().y);
View Full Code Here

    Vector2d relVel = new Vector2d();
    relVel.sub(fo1.getVelocity(), fo2.getVelocity());
    Polygon p1 = fo1.getBoundingArea();
    p1.translate((int)fo1.getPosition().x, (int)fo1.getPosition().y);
    Polygon p2 = fo2.getBoundingArea();
    p2.translate((int)fo2.getPosition().x, (int)fo2.getPosition().y);
    PolygonCollisionResult res = PolygonCollision(p1, p2, relVel);
    p1.translate((int)-fo1.getPosition().x, (int)-fo1.getPosition().y);
    p2.translate((int)-fo2.getPosition().x, (int)-fo2.getPosition().y);
    return (res.doesIntersect); // || res.willIntersect);
  }
View Full Code Here

    p1.translate((int)fo1.getPosition().x, (int)fo1.getPosition().y);
    Polygon p2 = fo2.getBoundingArea();
    p2.translate((int)fo2.getPosition().x, (int)fo2.getPosition().y);
    PolygonCollisionResult res = PolygonCollision(p1, p2, relVel);
    p1.translate((int)-fo1.getPosition().x, (int)-fo1.getPosition().y);
    p2.translate((int)-fo2.getPosition().x, (int)-fo2.getPosition().y);
    return (res.doesIntersect); // || res.willIntersect);
  }

  private static class ProjectionResult {
    double min;
View Full Code Here

        if (tile != null) {
          if (layer instanceof SelectionLayer) {
            gridPoly.translate(gx, gy);
            g2d.fillPolygon(gridPoly);
            gridPoly.translate(-gx, -gy);
            // paintEdge(g, layer, gx, gy);
          } else {
            tile.draw(g2d, gx, gy, zoom);
          }
        }
View Full Code Here

    if (hexEdgesToTheLeft) {
      for (int x = startX; x <= endX; x++) {
        grid = createGridPolygon(x, startY, 1);
        for (int y = startY; y <= endY; y++) {
          g2d.drawPolygon(grid);
          grid.translate(0, tileSize.height + 1);
        }
      }
    } else {
      for (int y = startY; y <= endY; y++) {
        grid = createGridPolygon(startX, y, 1);
View Full Code Here

    } else {
      for (int y = startY; y <= endY; y++) {
        grid = createGridPolygon(startX, y, 1);
        for (int x = startX; x <= endX; x++) {
          g2d.drawPolygon(grid);
          grid.translate(tileSize.width + 1, 0);
        }
      }
    }
  }
View Full Code Here

        if (tile != null) {
          if (layer instanceof SelectionLayer) {
            // Polygon gridPoly = createGridPolygon(
            // drawLoc.x, drawLoc.y - tileSize.height, 0);
            gridPoly.translate(drawLoc.x, drawLoc.y);
            g2d.fillPolygon(gridPoly);
            gridPoly.translate(-drawLoc.x, -drawLoc.y);
            // paintEdge(g2d, layer, drawLoc.x, drawLoc.y);
          } else {
            tile.draw(g2d, drawLoc.x, drawLoc.y, zoom);
View Full Code Here

          if (layer instanceof SelectionLayer) {
            // Polygon gridPoly = createGridPolygon(
            // drawLoc.x, drawLoc.y - tileSize.height, 0);
            gridPoly.translate(drawLoc.x, drawLoc.y);
            g2d.fillPolygon(gridPoly);
            gridPoly.translate(-drawLoc.x, -drawLoc.y);
            // paintEdge(g2d, layer, drawLoc.x, drawLoc.y);
          } else {
            tile.draw(g2d, drawLoc.x, drawLoc.y, zoom);
          }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.