Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Vector2f


  }

  public Vector2f getPlayerCenter() {
    Entity ent = find(FuzzyPlayer.PLAYER);
    if (ent != null) {
      return new Vector2f(ent.x + ent.width / 2, ent.y + ent.height / 2);
    }
    return null;
  }
View Full Code Here


    protected Vector2f position;
    protected Vector2f speed;
    protected Level currentLevel;

    public Entity() {
        position = new Vector2f();
        speed = new Vector2f();
    }
View Full Code Here

    private Vector2f dimensions, offset;
    private DragListener dragListener;

    public SimpleDraggable(Shape s) {
        shape = s;
        dimensions = new Vector2f();
        dimensions.x = s.getMaxX() - s.getX();
        dimensions.y = s.getMaxY() - s.getY();
        setShape(s);
        offset = new Vector2f(s.getX(), s.getY());
        super.addListener((DragListener) this);
        dragListener = NullListener.getSingleton();
    }
View Full Code Here

    fFrames = 0;
    fFrame = 0;
    if (fOffsets == null) {
      fOffsets = new Vector2f[images.length];
      for (int i = 0; i < images.length; i++) {
        fOffsets[i] = new Vector2f(0, 0);
      }
    }
    // Calculate span
    fSpan = new Rectangle(0, 0, 0, 0);
    for (int i = 0; i < images.length; i++) {
View Full Code Here

  public Vector2f origin() {
    return fOrigin;
  }

  public Vector2f tileToVector(GridCoordinate tile) {
    return new Vector2f(tile.x() * fSize.x + fOrigin.x, tile.y() * fSize.y + fOrigin.y);
  }
View Full Code Here

      @Override
      public void begin() {
        super.begin();
        // Randomly position
        position(position().add(new Vector2f((float) (Math.random() * 30 - 15), (float) (Math.random() * 30 - 15))));
      }

      @Override
      protected void run(Graphics graphics, long currentTime, float interval) {
        float m = interval * interval;
        if (interval < 0.2) {
          rotate(m * 360 * 26 + (float) fRotate);
          scale(new Vector2f(m * 20, m * 20));
          opacity(interval * 5);
        } else if (interval < 0.5) {
          // Do nothing
        } else {
          opacity((float) (1 - (interval - 0.5) * 2));
 
View Full Code Here

  }

  @Override
  protected void run(Graphics graphics, Viewport view, long currentTime, float interval) {
    // Re-use position variable to avoid creating a new object during render phase
    Vector2f pos = fParent.position();
    pos.set(fOrigin);
    pos.x += (fTarget.x - pos.x) * interval;
    pos.y += (fTarget.y - pos.y) * interval;
    fParent.position(pos);
  }
 
View Full Code Here

  public int hashCode() {
    return fX * 256 + fY;
  }

  public Vector2f toVector2f() {
    return new Vector2f(fX, fY);
  }
View Full Code Here

  public Vector2f toVector2f() {
    return new Vector2f(fX, fY);
  }

  public Vector2f multiplyPartsByVector(Vector2f factor) {
    Vector2f v = new Vector2f(0, 0);
    v.x = fX * factor.x;
    v.y = fY * factor.y;
    return v;
  }
View Full Code Here

    setup(gridEntity().gridManager().tileToVector(nextTile));
   
    begin();
   
    // Set the tile
    Vector2f old = fParent.position().copy();
    gridEntity().setTile(nextTile);
    // Don't actually move there though!
    fParent.position(old);
  }
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.