Package com.googlecode.jumpnevolve.math

Examples of com.googlecode.jumpnevolve.math.Vector


  @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


   * Es wird das Rechteck zwischen Position und unterer rechter Ecke des
   * Interfaceables als Size gesetzt
   */
  public void maximizeSize() {
    this.toMaximize = MAXIME_BOTH;
    Vector pos = Vector.ZERO;
    Interfaceable inter = this.getInterfaceable();
    if (inter != null) {
      if (this.parentContainer != null) {
        pos = this.parentContainer.getPositionFor(this);
      }
View Full Code Here

   * Es wird die maximal verfügbare Breite gewählt und die Höhe über
   * getWantedSize() ermittelt
   */
  public void maximizeXRange() {
    this.toMaximize = MAXIME_X;
    Vector pos = Vector.ZERO;
    Interfaceable inter = this.getInterfaceable();
    if (inter != null) {
      if (this.parentContainer != null) {
        pos = this.parentContainer.getPositionFor(this);
      }
View Full Code Here

   * Es wird die maximal verfügbare Höhe gewählt und die Breite über
   * getWantedSize() ermittelt
   */
  public void maximizeYRange() {
    this.toMaximize = MAXIME_Y;
    Vector pos = Vector.ZERO;
    Interfaceable inter = this.getInterfaceable();
    if (inter != null) {
      if (this.parentContainer != null) {
        pos = this.parentContainer.getPositionFor(this);
      }
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

        this.interfaceableAdded = true;
      }
    }
    if (this.getNeededSize()
        .modifyCenter(this.getCenterVector())
        .isPointInThis(new Vector(input.getMouseX(), input.getMouseY()))) {
      if (input.isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
        onMouseDown(STATUS_PRESSED);
      } else if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
        onMouseDown(STATUS_DOWN);
      } else {
View Full Code Here

   *         die Translation durch die Kamera
   */
  public Vector getCenterVector() {
    Rectangle size = this.getNeededSize();
    return this.parent.getPositionFor(this).add(
        new Vector(size.getDistanceToSide(Shape.LEFT), size
            .getDistanceToSide(Shape.UP)));
  }
View Full Code Here

    this.gui = new MainGUI(this);
    this.gui.setMainContainer(headCon);

    // Kamera setzen
    this.setCamera(new EditorCamera(this));
    this.setCameraPosition(new Vector(this.getWidth(), this.getHeight())
        .div(2.0f));

    // Zoom auf 1 setzen, damit das Interface richtig dargestellt wird
    this.setZoom(1);
View Full Code Here

    y = y - (float) this.getHeight() / 2;
    x = x / this.getZoomX();
    y = y / this.getZoomY();
    x = x + this.getCameraPosX();
    y = y + this.getCameraPosY();
    return new Vector(x, y);
  }
View Full Code Here

    }
    if (!this.guiAction) {
      this.guiAction = PositionMarker.isAnyMarkerSelected();
    }
    if (!Dialog.isAnyDialogActive()) {
      Vector mousePos = new Vector(input.getMouseX(), input.getMouseY());
      Vector translatedMousePos = this.translateMousePos(mousePos);
      if (!guiAction) {
        if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)
            && this.lastFunction instanceof GameObjects
            && !this.newObjectTimer.isRunning()) {
          this.addNewObject((GameObjects) this.lastFunction,
              translatedMousePos);
          this.newObjectTimer.start(OBJECT_DELAY);
          this.lastFunction = null;
        }
      }
      if (this.selected == null) {
        this.playerPosition.poll(input, secounds);
        if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)
            && !this.playerPosition.isMoving()) {
          if (!this.guiAction) {
            // Kamera verschieben
            if (!this.cameraMove) {
              this.oldClick = mousePos;
            }
            this.cameraMove = true;
            if (this.oldClick == null) {
              this.oldClick = mousePos;
            }
            Vector dif = mousePos.sub(oldClick);
            dif = dif.modifyX(dif.x / this.getZoomX());
            dif = dif.modifyY(dif.y / this.getZoomY());
            this.setCameraPosition(this.oldCameraPos.sub(dif));
          }
        } else {
          this.cameraMove = false;
          this.oldCameraPos = this.getCameraPos();
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.