Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Vector2f


   * Import from JSON
   * @param object The JSON serialization of the logic
   */
  public void importFromJSON(JSONObject object) {
    String[] str = object.optString("xy").split(" ");
    Vector2f pos = new Vector2f(Float.valueOf(str[0]), Float.valueOf(str[1]));
    if (fSnapToGrid) position(new Vector2f((int) Math.round((pos.x - 16f) / 32f) * 32f + 16f, (int) Math.round((pos.y - 16f) / 32f) * 32f + 16f));
    else position(pos);
    order((int) position().y);
  }
View Full Code Here


      fStart = local;
      if (fEnabled) select();
    }
    if (!fMap.editing()) return;
    if (type.equals("mouse.drag")) {
      Vector2f change = local.sub(fStart);
      if (fSnapToGrid)
        change = new Vector2f((int) Math.round(change.x / 32f) * 32f, (int) Math.round(change.y / 32f) * 32f);
      position(position().add(change));
      order((int) position().y);
    }
  }
View Full Code Here

   */
  public void importFromWWD(String logic, String image, String animation, byte[] data) {
    fSnapToGrid = true;
    fFixed = 10000;
    fSpan = new Rectangle(0, 0, 17, 17);
    Vector2f pos = MonolithWWD.readPosition(data);
    position(new Vector2f((int) Math.floor((pos.x) / 32f) * 32f - 1, (int) Math.floor((pos.y) / 32f) * 32f - 1));
    order(10000);
  }
View Full Code Here

  public void importFromJSON(JSONObject object) {
    fSnapToGrid = true;
    fFixed = 10000;
    fSpan = new Rectangle(0, 0, 17, 17);
    String[] str = object.optString("xy").split(" ");
    Vector2f pos = new Vector2f(Float.valueOf(str[0]), Float.valueOf(str[1]));
    position(new Vector2f((int) Math.floor((pos.x) / 32f) * 32f - 1, (int) Math.floor((pos.y) / 32f) * 32f - 1));
    order(10000);
  }
View Full Code Here

      fStart = local;
      select();
    }
    if (!fMap.editing()) return;
    else if (type.equals("mouse.drag")) {
      Vector2f change = local.sub(fStart);
      if (fSnapToGrid && !PointClikiGame.inputManager().isAltPressed())
        change = new Vector2f((int) Math.round((change.x - 16f) / 16f) * 16f + 16f, (int) Math.round((change.y - 16f) / 16f) * 16f + 16f);
      position(position().add(change));
    }
  }
View Full Code Here

  }

  @Override
  public void mouseDragged(int oldX, int oldY, int newX, int newY) {
    EventSystem.getInstance().pushEvent(new MouseMovedEvent(this, new Vector2f(oldX, oldY), new Vector2f(newX, newY)));
  }
View Full Code Here

    EventSystem.getInstance().pushEvent(new MouseMovedEvent(this, new Vector2f(oldX, oldY), new Vector2f(newX, newY)));
  }

  @Override
  public void mouseMoved(int oldX, int oldY, int newX, int newY) {
    EventSystem.getInstance().pushEvent(new MouseMovedEvent(this, new Vector2f(oldX, oldY), new Vector2f(newX, newY)));
  }
View Full Code Here

    EventSystem.getInstance().pushEvent(new MouseMovedEvent(this, new Vector2f(oldX, oldY), new Vector2f(newX, newY)));
  }

  @Override
  public void mousePressed(int button, int x, int y) {
    EventSystem.getInstance().pushEvent(new MousePressedEvent(this, new Vector2f(x, y), button));
  }
View Full Code Here

    EventSystem.getInstance().pushEvent(new MousePressedEvent(this, new Vector2f(x, y), button));
  }

  @Override
  public void mouseReleased(int button, int x, int y) {
    EventSystem.getInstance().pushEvent(new MouseReleasedEvent(this, new Vector2f(x, y), button));
  }
View Full Code Here

    return false;
  }
 
  @Override
  public void setVector(Vector2f newVector) {
    Vector2f oldVector = getVector();
    super.setVector(newVector);
    if(oldVector != null && !oldVector.equals(newVector)){
      EventSystem.getInstance().pushEvent(new PositionChangedEvent(this, oldVector, newVector));
    }
  }
View Full Code Here

TOP

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

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.