Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Vector2f


     * @param t The time value (expecting t in [0,1])
     * @return The value to use at the specified time
     */
    public float getValue(float t) {
      // first: determine the segment we are in
      Vector2f p0 = (Vector2f) curve.get(0);
      for (int i = 1; i < curve.size(); i++) {
        Vector2f p1 = (Vector2f) curve.get(i);

        if (t >= p0.getX() && t <= p1.getX()) {
          // found the segment
          float st = (t - p0.getX())
              / (p1.getX() - p0.getX());
          float r = p0.getY() + st
              * (p1.getY() - p0.getY());
          // System.out.println( "t: " + t + ", " + p0.x + ", " + p0.y
          // + " : " + p1.x + ", " + p1.y + " => " + r );

          return r;
        }
View Full Code Here


      element.setAttribute("active", ""
          + ((LinearInterpolator) value).isActive());

      ArrayList curve = ((LinearInterpolator) value).getCurve();
      for (int i = 0; i < curve.size(); i++) {
        Vector2f point = (Vector2f) curve.get(i);

        Element pointElement = document.createElement("point");
        pointElement.setAttribute("x", "" + point.x);
        pointElement.setAttribute("y", "" + point.y);
View Full Code Here

          Element point = (Element) points.item(i);

          float x = Float.parseFloat(point.getAttribute("x"));
          float y = Float.parseFloat(point.getAttribute("y"));

          curve.add(new Vector2f(x, y));
        }

        ((LinearInterpolator) value).setCurve(curve);
        ((LinearInterpolator) value).setMin(Integer.parseInt(min));
        ((LinearInterpolator) value).setMax(Integer.parseInt(max));
View Full Code Here

    float xStep = x1 + xMod * (int) (moveProgress * Math.cos(this.angle));
    float yStep = y1 + yMod * (int) (moveProgress * Math.sin(this.angle));
   
    //System.out.println(" x:"+x1+" y:"+y1);
    //System.out.println("step "+currentTime+ " x:"+xStep+" y:"+yStep);
    current = new Vector2f(xStep, yStep);
  }
View Full Code Here

    float catAd = Math.abs(x2 - x1);
    float catOp = Math.abs(y2 - y1);
   
    //double hip = Math.sqrt(Math.pow(catAd,2) + Math.pow(catOp,2));
    angle = Math.atan(catOp/catAd);
    current = new Vector2f(x1, y1);
  }
View Full Code Here

 
  private final int width = 60;
  private final int height = 60;
 
  public PlayerAvatar(Animation avatar, int xPos, int yPos) {
    this.position = new Vector2f(xPos, yPos);
    this.avatar = avatar;
  }
View Full Code Here

  }
 
  public Vector2f getFeetPosition() {
    float feetx = position.x - (width /2);
    float feety = position.y - height;
    return(new Vector2f(feetx, feety));
  }
View Full Code Here

   
    if (input.isMousePressed(0)) {
      int mouseX = input.getMouseX();
      int mouseY = input.getMouseY();
     
      motionHandler = new PlayerMotionHandler(1, playerAvatar.getAvatar(), new Vector2f(mouseX, mouseY), 0);
      motionHandler.isActivating(playerAvatar.getPosition(), delta);
    }
  }
View Full Code Here

   * @param ey The y coordinate of the ending control point
   * @param endCol The colour to apply at the ending control point
   */
  public GradientFill(float sx, float sy, Color startCol, float ex, float ey, Color endCol)
  {
    this(new Vector2f(sx,sy), startCol, new Vector2f(ex,ey), endCol);
  }
View Full Code Here

   * @param startCol The colour to apply at the starting control point
   * @param end The position of the ending control point
   * @param endCol The colour to apply at the ending control point
   */
  public GradientFill(Vector2f start, Color startCol, Vector2f end, Color endCol) {
    this.start = new Vector2f(start);
    this.end = new Vector2f(end);
    this.startCol = new Color(startCol);
    this.endCol = new Color(endCol);
  }
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.