Package gwt.g2d.client.math

Examples of gwt.g2d.client.math.Vector2


 
  /**
   * Gets the size of the surface.
   */
  public Vector2 getSize() {
    return new Vector2(getWidth(), getHeight());
  }
View Full Code Here


  /**
   * Gets the distance that the shadow will be offset in the positive
   * horizontal and vertical direction.
   */
  public Vector2 getShadowOffset() {
    return new Vector2(context.getShadowOffsetX(), context.getShadowOffsetY());
  }
View Full Code Here

 
  /**
   * Gets the size of the surface.
   */
  public Vector2 getSize() {
    return new Vector2(getWidth(), getHeight());
  }
View Full Code Here

  /**
   * Gets the distance that the shadow will be offset in the positive
   * horizontal and vertical direction.
   */
  public Vector2 getShadowOffset() {
    return new Vector2(context.getShadowOffsetX(), context.getShadowOffsetY());
  }
View Full Code Here

    add(getPrimarySurface());
    shapeRenderer = new DirectShapeRenderer(getPrimarySurface());
    particles.clear();
    for (int i = 0; i < NUM_PARTICLES; i++) {
      particles.add(new Particle(
          new Vector2(Random.nextInt(WIDTH), Random.nextInt(HEIGHT)),
          new Vector2(Math.random(), Math.random()).normalize(),
          new Color(Random.nextInt(256),
              Random.nextInt(256),
              Random.nextInt(256),
              Math.random())));
    }
View Full Code Here

  }

  @Override
  public void update() {
    for (Particle p : particles) {
      Vector2 pos = p.getPosition();
      Vector2 vel = p.getVelocity();
      if (pos.getX() < 0) {
        vel.setX(Math.abs(vel.getX()));
      } else if (pos.getX() >= WIDTH) {
        vel.setX(-Math.abs(vel.getX()));
      }
      if (pos.getY() < 0) {
        vel.setY(Math.abs(vel.getY()));
      } else if (pos.getY() >= HEIGHT) {
        vel.setY(-Math.abs(vel.getY()));
      }
      pos.mutableAdd(p.getVelocity());
    }
    draw();
  }
View Full Code Here

 
  /**
   * Gets the size of the surface.
   */
  public Vector2 getSize() {
    return new Vector2(getWidth(), getHeight());
  }
View Full Code Here

  /**
   * Gets the distance that the shadow will be offset in the positive
   * horizontal and vertical direction.
   */
  public Vector2 getShadowOffset() {
    return new Vector2(context.getShadowOffsetX(), context.getShadowOffsetY());
  }
View Full Code Here

 
    // Use the gradient for the fillStyle.
    getPrimarySurface().setFillStyle(gradient)
   
        // Now let's draw a rectangle with a black shadow.
        .setShadowOffset(new Vector2(5, 5))
        .setShadowBlur(4)
        .setShadowColor(new Color(0, 0, 0, .5))
        .fillRectangle(5, 5, 200, 100)
       
        // For effect, let's also draw some text: "Hello world!".
View Full Code Here

    private final Vector2 pos, speed;
    private final int[] color = new int[3];
    private final int[] colorSpeed = {1, 1, 1};

    public Sprite() {
      pos = new Vector2(MAX).scale(.5).add(
          new Vector2(getRandomInt(-50, 50), getRandomInt(-50, 50)));
      speed = new Vector2(SPEED_MAX);
      for (int i = 0; i < 3; i++) {
        color[i] = getRandomInt(COLOR_MIN, COLOR_MAX);
      }
    }
View Full Code Here

TOP

Related Classes of gwt.g2d.client.math.Vector2

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.