Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Polygon


      y1 = Float.parseFloat(element.getAttribute("y1"));
      y2 = Float.parseFloat(element.getAttribute("y2"));
    } else {
      String points = element.getAttribute("d");
      StringTokenizer tokens = new StringTokenizer(points, ", ");
      Polygon poly = new Polygon();
      if (processPoly(poly, element, tokens) == 2) {
        x1 = poly.getPoint(0)[0];
        y1 = poly.getPoint(0)[1];
        x2 = poly.getPoint(1)[0];
        y2 = poly.getPoint(1)[1];
      } else {
        return;
      }
    }
   
View Full Code Here


    image1 = new Image("testdata/grass.png");
    image2 = new Image("testdata/rocks.png");
   
    fill = new GradientFill(-64,0,new Color(1,1,1,1f),64,0,new Color(0,0,0,0));
    shape = new Rectangle(336,236,128,128);
      poly = new Polygon();
    poly.addPoint(320,220);
    poly.addPoint(350,200);
    poly.addPoint(450,200);
    poly.addPoint(480,220);
    poly.addPoint(420,400);
View Full Code Here

  /**
   * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
   */
  public void init(GameContainer container) throws SlickException {
    poly = new Polygon();
    poly.addPoint(300, 100);
    poly.addPoint(320, 200);
    poly.addPoint(350, 210);
    poly.addPoint(280, 250);
    poly.addPoint(300, 200);
View Full Code Here

    container.setMouseCursor(temp, 0, 0);
   
    container.setIcons(new String[] {"testdata/icon.tga"});
    container.setTargetFrameRate(100);
   
    poly = new Polygon();
    float len = 100;
   
    for (int x=0;x<360;x+=30) {
      if (len == 100) {
        len = 50;
View Full Code Here

    rect = new Rectangle(400,100,200,150);
    round = new RoundedRectangle(150,100,200,150,50);
    round2 = new RoundedRectangle(150,300,200,150,50);
    center = new Rectangle(350,250,100,100);
   
    poly = new Polygon();
    poly.addPoint(400,350);
    poly.addPoint(550,320);
    poly.addPoint(600,380);
    poly.addPoint(620,450);
    poly.addPoint(500,450);
View Full Code Here

  /**
   * Perform the cut
   */
  public void init() {
    Polygon source = new Polygon();
    source.addPoint(100,100);
    source.addPoint(150,80);
    source.addPoint(210,120);
    source.addPoint(340,150);
    source.addPoint(150,200);
    source.addPoint(120,250);
    this.source = source;
   
    circle = new Circle(0,0,50);
    rect = new Rectangle(-100,-40,200,80);
    star = new Polygon();
   
    float dis = 40;
    for (int i=0;i<360;i+=30) {
      dis = dis == 40 ? 60 : 40;
      double x = (Math.cos(Math.toRadians(i)) * dis);
 
View Full Code Here

   */
  public void init(GameContainer container) throws SlickException {
    container.getGraphics().setBackground(Color.white);
   
    curve = new Curve(p2,c2,c1,p1);
    poly = new Polygon();
    poly.addPoint(500,200);
    poly.addPoint(600,200);
    poly.addPoint(700,300);
    poly.addPoint(400,300);
  }
View Full Code Here

    for (int x=0;x<segments;x++) {
      for (int y=0;y<segments;y++) {
        quadSpace[x][y] = new ArrayList();
       
        // quad for this segment
        Polygon segmentPolygon = new Polygon();
        segmentPolygon.addPoint(minx+(dx*x), miny+(dy*y));
        segmentPolygon.addPoint(minx+(dx*x)+dx, miny+(dy*y));
        segmentPolygon.addPoint(minx+(dx*x)+dx, miny+(dy*y)+dy);
        segmentPolygon.addPoint(minx+(dx*x), miny+(dy*y)+dy);
       
        for (int i=0;i<shapes.size();i++) {
          Shape shape = (Shape) shapes.get(i);
         
          if (collides(shape, segmentPolygon)) {
View Full Code Here

    for (int x = 0; x < map[0].length; x++) {
      for (int y = 0; y < map.length; y++) {
        if (map[y][x] != 0) {
          switch (map[y][x]) {
          case 1:
            Polygon p2 = new Polygon();
            p2.addPoint(x * 32, y * 32);
            p2.addPoint((x * 32) + 32, y * 32);
            p2.addPoint((x * 32) + 32, (y * 32) + 32);
            p2.addPoint(x * 32, (y * 32) + 32);
            original.add(p2);
            break;
          case 2:
            Polygon poly = new Polygon();
            poly.addPoint(x * 32, y * 32);
            poly.addPoint((x * 32) + 32, y * 32);
            poly.addPoint(x * 32, (y * 32) + 32);
            original.add(poly);
            break;
          case 3:
            Circle ellipse = new Circle((x*32)+16,(y*32)+32,16,16);
            original.add(ellipse);
            break;
          case 4:
            Polygon p = new Polygon();
            p.addPoint((x * 32) + 32, (y * 32));
            p.addPoint((x * 32) + 32, (y * 32)+32);
            p.addPoint(x * 32, (y * 32) + 32);
            original.add(p);
            break;
          case 5:
            Polygon p3 = new Polygon();
            p3.addPoint((x * 32), (y * 32));
            p3.addPoint((x * 32) + 32, (y * 32));
            p3.addPoint((x * 32) + 32, (y * 32)+32);
            original.add(p3);
            break;
          case 6:
            Polygon p4 = new Polygon();
            p4.addPoint((x * 32), (y * 32));
            p4.addPoint((x * 32) + 32, (y * 32));
            p4.addPoint((x * 32), (y * 32)+32);
            original.add(p4);
            break;
          }
        }
      }
 
View Full Code Here

 
  public void createPoly(float x, float y) {
    int size = 20;
    int change = 10;

    randomShape = new Polygon();
    // generate random polygon
    randomShape.addPoint(0 + (int)(Math.random() * change), 0 + (int)(Math.random() * change));
    randomShape.addPoint(size - (int)(Math.random() * change), 0 + (int)(Math.random() * change));
    randomShape.addPoint(size - (int)(Math.random() * change), size - (int)(Math.random() * change));
    randomShape.addPoint(0 + (int)(Math.random() * change), size - (int)(Math.random() * change));
 
View Full Code Here

TOP

Related Classes of org.newdawn.slick.geom.Polygon

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.