コード例 #1
0
  /**
   * Gets the boundary of the widget, should be used as a way to detect overlapping widgets.
   *
   * @return The four corners x,y coordinates.
   */
  public Vector2f[] getBoundary() {
    Box box = (Box) body.getShape();

    Vector2f[] bounds = new Vector2f[4];
    bounds[0] = new Vector2f(position.x, position.y);
    bounds[1] = new Vector2f(position.x + WIDTH, position.y);
    bounds[2] = new Vector2f(position.x + WIDTH, position.y + HEIGHT);
    bounds[3] = new Vector2f(position.x, position.y + HEIGHT);
    return bounds;
  }
コード例 #2
0
 /**
  * Retrieves the height of the widget based on the specified boundary.
  *
  * @return The height of the widget (based on the boundary).
  */
 private float getHeight() {
   return ((Box) body.getShape()).getSize().getY();
 }
コード例 #3
0
 /**
  * Retrieves the width of the widget based on the specified boundary.
  *
  * @return The width of the widget (based on the boundary).
  */
 private float getWidth() {
   return ((Box) body.getShape()).getSize().getX();
 }