Package com.googlecode.jumpnevolve.math

Examples of com.googlecode.jumpnevolve.math.Shape


    System.out.println("Zeit neu benötigt: " + (endTime - startTime));
  }

  @Test
  public void testSpeedOldRectCollisions() {
    Shape rect = new Rectangle(new Vector(10, 100), 20, 20);
    // Rectangle rect2 = new Rectangle(new Vector(10, 90), 20, 20);
    Shape rect2 = new Circle(new Vector(10, 90), 10);
    Date start = new Date();
    long startTime = start.getTime();
    for (int i = 0; i < 1000000; i++) {
      if (rect.doesCollide(rect2)) {
        rect.getCollision(rect2, false, true);
View Full Code Here


  }

  @Override
  public void draw(Graphics g) {
    Vector pos = this.getCenterVector();
    Shape actShape = this.shape.modifyCenter(pos);
    GraphicUtils.drawImage(g, actShape, ResourceManager.getInstance()
        .getImage(this.icon));
    Color c = g.getColor();
    switch (this.getStatus()) {
    case STATUS_MOUSE_OVER:
View Full Code Here

  @Override
  public Vector getPositionFor(InterfacePart object) {
    if (this.objects.containsKey(object)) {
      Rectangle place = (Rectangle) this.getNeededSize();
      Vector cell = this.objects.get(object);
      Shape shape = object.getNeededSize();
      int x = (int) (this.getXPosInCell((int) cell.x, (int) cell.y,
          place.width / cols, shape.getXRange()) + place.width / cols
          * cell.x);
      int y = (int) (this.getYPosInCell((int) cell.x, (int) cell.y,
          place.height / rows, shape.getYRange()) + place.height
          / rows * cell.y);
      return new Vector(x, y).add(this.parentContainer
          .getPositionFor(this));
    } else {
      return null;
View Full Code Here

    // }

    Object[] objectsCopy = objects.keySet().toArray();
    float width = 1, height = 1;
    for (Object object : objectsCopy) {
      Shape size = ((InterfacePart) object).getNeededSize();
      width = Math.max(width, size.getXRange());
      height = Math.max(height, size.getYRange());
    }
    return new Rectangle(Vector.ZERO, width * this.cols, height * this.rows);
  }
 
View Full Code Here

    }
  }

  private void drawBackground(Graphics g) {
    if (this.parentContainer != null) {
      Shape shape = this.getNeededSize();
      shape = shape.modifyCenter(this.parentContainer
          .getPositionFor(this).add(
              new Vector(shape.getXRange(), shape.getYRange())
                  .div(2.0f)));
      GraphicUtils.fill(g, shape, this.backgroundColor);
    }
  }
View Full Code Here

    return this.headlineCon;
  }

  @Override
  public Rectangle getWantedSize() {
    Shape head = this.headlineCon.getNeededSize(), main = this.mainCon
        .getNeededSize();
    return new Rectangle(Vector.ZERO, Math.max(head.getXRange(),
        main.getXRange()), head.getYRange() + main.getYRange());
  }
View Full Code Here

TOP

Related Classes of com.googlecode.jumpnevolve.math.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.