Package org.lwjgl.util.vector

Examples of org.lwjgl.util.vector.Vector2f


        blocks.removeFirst();
      }
      break;
    }

    this.firstCorner = new Vector2f(firstCorner.x, firstCorner.y);
  }
View Full Code Here


        blocks.removeLast();
      }
      break;
    }

    this.secondCorner = new Vector2f(secondCorner.x, secondCorner.y);
  }
View Full Code Here

  public boolean isMovable() {
    return false;
  }

  public Vector2f getCornerPos(CornerPlace corner) {
    Vector2f p = getPosition();
    switch (corner) {
    case TOP_LEFT:
      return new Vector2f(p.x - width / 2.0f, p.y + height / 2.0f);
    case TOP_RIGHT:
      return new Vector2f(p.x + width / 2.0f, p.y + height / 2.0f);
    case BOTTOM_LEFT:
      return new Vector2f(p.x - width / 2.0f, p.y - height / 2.0f);
    case BOTTOM_RIGHT:
      return new Vector2f(p.x + width / 2.0f, p.y - height / 2.0f);

    default:
      throw new IllegalArgumentException("corner does not have a valid value");
    }
  }
View Full Code Here

  public void draw() {
    // store current transformation matrix
    GL11.glPushMatrix();

    // translate to ball position
    Vector2f pos = ball.getPosition();
    GL11.glTranslatef(pos.x, pos.y, 0.0f);

    // set color
    appearance.use();
View Full Code Here

  /** Call this method when a ball hits the block */
  public void notifyHit(Ball ball) {
    Paddle lastPaddle = ball.getLastPaddle();
    if (lastPaddle != null) {
      float itemSpeed = 2.0f;
      Vector2f itemVelocity = null;

      switch (lastPaddle.getPlace()) {
      case LEFT:
        itemVelocity = new Vector2f(-itemSpeed, 0.0f);
        break;

      case RIGHT:
        itemVelocity = new Vector2f(itemSpeed, 0.0f);
        break;

      case TOP:
        itemVelocity = new Vector2f(0.0f, itemSpeed);
        break;

      case BOTTOM:
        itemVelocity = new Vector2f(0.0f, -itemSpeed);
        break;

      default:
        throw new IllegalStateException("Paddle in unspecified place");
      }
View Full Code Here

    this.ball = ball;
  }

  @Override
  public Vector3f getPosition() {
    Vector2f pos = ball.getPosition();
    return new Vector3f(pos.x, pos.y, 0.0f);
  }
View Full Code Here

  private Vector2f position;
  private Vector2f velocity;

  public Entity() {
    position = new Vector2f(0.0f, 0.0f);
    velocity = new Vector2f(0.0f, 0.0f);
  }
View Full Code Here

    position = new Vector2f(0.0f, 0.0f);
    velocity = new Vector2f(0.0f, 0.0f);
  }

  public final Vector2f getPosition() {
    return new Vector2f(position.x, position.y);
  }
View Full Code Here

  public final Vector2f getPosition() {
    return new Vector2f(position.x, position.y);
  }

  public final void setPosition(Vector2f position) {
    this.position = new Vector2f(position.x, position.y);
  }
View Full Code Here

  public final void setPosition(Vector2f position) {
    this.position = new Vector2f(position.x, position.y);
  }

  public final Vector2f getVelocity() {
    return new Vector2f(velocity.x, velocity.y);
  }
View Full Code Here

TOP

Related Classes of org.lwjgl.util.vector.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.