示例#1
0
  @Override
  public synchronized void circle(V2 centre, float radius, boolean fill) {
    // move based on camera position where applicable
    V2 pov_centre;
    if (use_camera) {
      radius *= camera.getZoom();
      pov_centre = camera.getPerspective(centre);
    } else pov_centre = centre;

    draw_queue.add(
        new DrawShape(
            new Ellipse2D.Float(
                pov_centre.x - radius, pov_centre.y - radius, radius * 2, radius * 2),
            fill));
  }
示例#2
0
  @Override
  public void angleBox(V2 o, V2 d, float size, boolean fill) {
    // move based on camera position where applicable
    V2 po = (use_camera) ? camera.getPerspective(o) : o;
    // scale direction-vector based on zoom
    V2 pd = (use_camera) ? d.clone().scale(camera.getZoom() * size) : d.clone().scale(size);

    int
        xpts
        [] =
            {
              (int) (po.x + pd.x + pd.y), (int) (po.x + pd.x - pd.y),
              (int) (po.x + -pd.x - pd.y), (int) (po.x + -pd.x + pd.y)
            },
        ypts
        [] =
            {
              (int) (po.y + -pd.x + pd.y), (int) (po.y + pd.x + pd.y),
              (int) (po.y + pd.x - pd.y), (int) (po.y + -pd.x - pd.y)
            };
    draw_queue.add(new DrawShape(new Polygon(xpts, ypts, 4), fill));
  }