Package com.googlecode.jumpnevolve.math

Examples of com.googlecode.jumpnevolve.math.Vector


    float x, y;
    x = position.x / factor;
    y = position.y / factor;
    x = Math.round(x) * factor;
    y = Math.round(y) * factor;
    return new Vector(x, y);
  }
View Full Code Here


      drawScaled(g, (Rectangle) shape, zoom);
    }
  }

  public static void drawScaled(Graphics g, Rectangle rect, float zoom) {
    Rectangle rect2 = new Rectangle(rect.getCenter(), new Vector(rect.width
        / 2.0f * zoom, rect.height / 2.0f * zoom));
    draw(g, rect2);
  }
View Full Code Here

  }

  @Override
  public void poll(Input input, float secounds) {
    super.poll(input, secounds);
    Vector newDirection = this.getReferenceVector();
    float ang = newDirection.clockWiseAng()
        - this.lastRefernceDirection.clockWiseAng();
    this.calculateNewPosition(ang);
    this.lastRefernceDirection = newDirection;
  }
View Full Code Here

        this.position, color);
  }

  @Override
  public void initialize(String value) {
    Vector dimension = Vector.parseVector(value).rotate(
        this.getReferenceVector().clockWiseAng());
    this.lastRefernceDirection = this.getReferenceVector();
    super.initialize(dimension.toString());
  }
View Full Code Here

  @Override
  public String getArgumentPart() {
    // pos: aktuelle Position dieses Markers
    // ref: Richtung nach der das Rechteck ausgerichtet wird
    Vector pos = this.getPosition().sub(this.getParentPosition()), ref = this
        .getReferenceVector(), re = Vector.ZERO;

    // Vektor entsprechend der Ausrichtung berechnen
    re = pos.rotate(-ref.clockWiseAng());

    // Dimensionsangaben sind immer positiv
    // Jedes Rechteck muss über Breite und Höhe verfügen
    re = re.modifyX(Math.max(Math.abs(re.x), 1));
    re = re.modifyY(Math.max(Math.abs(re.y), 1));
View Full Code Here

  }

  @Override
  public void poll(Input input, float secounds) {
    super.poll(input, secounds);
    Vector parentPosition = this.getParentPosition();
    Vector diff = parentPosition.sub(this.lastParentPosition);
    this.addToPosition(diff);
    this.lastParentPosition = parentPosition;
  }
View Full Code Here

        BUTTON_DIMENSION);
  }

  @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()) {
View Full Code Here

  }

  @Override
  public void poll(Input input, float secounds) {
    if (selected == this || selected == null) {
      Vector mousePos = this.getEditor().translateMousePos(
          input.getMouseX(), input.getMouseY());
      if (this.wasInCircle) {
        this.changePosition(mousePos);
      }
      if ((this.shape.isPointIn(mousePos) || this.wasInCircle)
View Full Code Here

    if (this.shape.equals(new Rectangle(Vector.ZERO, 1, 1))) {
      int width = Font.getWidth(this.buttonText);
      int height = Font.getHeight(this.buttonText);
      this.shape = new Rectangle(Vector.ZERO, width, height);
    }
    Vector pos = this.getCenterVector();
    this.shape = (Rectangle) this.shape.modifyCenter(pos);
    Color c = g.getColor();
    switch (this.getStatus()) {
    case STATUS_MOUSE_OVER:
      g.setColor(Color.yellow);
View Full Code Here

  public void draw(Graphics g) {
    if (font == null) {
      font = g.getFont();
    }
    Rectangle rect = (Rectangle) this.getNeededSize();
    Vector center = this.getCenterVector();

    GraphicUtils.fill(g, rect.modifyCenter(center), Color.blue);

    Vector pos = this.parent.getPositionFor(this);
    GraphicUtils.drawString(g, pos.add(2, 0), this.content1);

    float xModifier = g.getFont().getWidth(this.content1);
    GraphicUtils.drawString(g, pos.add(xModifier + 5, 0), this.content2);
    GraphicUtils.draw(
        g,
        new PointLine(pos.add(xModifier + 3, 3), pos.add(xModifier + 3,
            15)), Color.white);

    GraphicUtils.draw(g, this.getNeededSize().getBoundingRect()
        .modifyCenter(center), Color.white);
  }
View Full Code Here

TOP

Related Classes of com.googlecode.jumpnevolve.math.Vector

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.