示例#1
0
  public void paintReticle(final TableItem item) {
    if (cursor != null) {
      mapShell.removePaintListener(cursor);
    }
    cursor =
        new PaintListener() {
          public void paintControl(PaintEvent pe) {
            int x = 0, y = 0;
            float xF = 0.0F, yF = 0.0F;

            Entity entity = dp.entityList.get(new Integer(item.getText(0)));

            xF = RadarConsts.WINDOW_BUFFER + dp.maxX - entity.posXAxis;
            yF = entity.posYAxis - (dp.minY - RadarConsts.WINDOW_BUFFER);

            x = (int) (xF * boundsXScale);
            y = (int) (yF * boundsYScale);

            pe.gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));

            pe.gc.drawRectangle(
                x - (RadarConsts.POINT_RADIUS * 2),
                y - (RadarConsts.POINT_RADIUS * 2),
                (RadarConsts.POINT_RADIUS * 4) - 1,
                (RadarConsts.POINT_RADIUS * 4));

            pe.gc.drawLine(
                x - (RadarConsts.POINT_RADIUS * 3), y, x + (RadarConsts.POINT_RADIUS * 3) - 1, y);
            pe.gc.drawLine(
                x, y - (RadarConsts.POINT_RADIUS * 3), x, y + (RadarConsts.POINT_RADIUS * 3) - 1);
          }
        };
    mapShell.addPaintListener(cursor);
    mapShell.redraw();
  }
示例#2
0
  public void clearMap(boolean performRedraw) {
    Listener[] painters;

    painters = mapShell.getListeners(SWT.Paint);

    for (int i = 0; i < painters.length; i++) mapShell.removeListener(SWT.Paint, painters[i]);

    if (performRedraw) mapShell.redraw();
  }
示例#3
0
  public void renderMap() {
    Entity entity;
    PaintListener playerIcon = null;

    if (dp == null) return;

    setBoundaryScalers();

    clearMap(false);

    playerZPos = dp.getEntity(dp.playerObjectID).posZAxis;

    for (int i = dp.entityKeys.length - 1; i >= 0; i--) {
      entity = dp.entityList.get(dp.entityKeys[i]);
      if (entity.entityName.equals("")) {
        continue;
      }

      if (isEntityIgnorable(entity.entityType)) {
        // But don't skip them if they matches the custom text.,
        java.util.regex.Pattern p = java.util.regex.Pattern.compile(customString.toLowerCase());
        Matcher m = p.matcher(entity.entityName.toLowerCase());
        if (!useCustomString || customString.equals("")) {
          continue;
        } else if (!m.find()) {
          continue;
        }
      }

      if (entity.entityType != Entity.TYPE_PLAYER) {
        mapShell.addPaintListener(paintGraph(entity));
      } else {
        playerIcon = paintGraph(entity);
      }
    }
    if (playerIcon != null) {
      mapShell.addPaintListener(playerIcon);
    }

    mapShell.redraw();
  }
示例#4
0
 public void redraw() {
   mapShell.redraw();
 }