Exemplo n.º 1
0
  public synchronized void draw() {
    gw.clear(1, 1, 1);
    gw.setColor(0, 0, 0);
    gw.setupForDrawing();

    gw.setCoordinateSystemToWorldSpaceUnits();
    gw.enableAlphaBlending();

    drawing.draw(gw);

    gw.setCoordinateSystemToPixels();

    for (int j = 0; j < Constant.NUM_USERS; ++j) {
      userContexts[j].draw(gw);
    }

    // Draw some text to indicate the number of fingers touching the user interface.
    // This is useful for debugging.
    int totalNumCursors = 0;
    String s = "[";
    for (int j = 0; j < Constant.NUM_USERS; ++j) {
      totalNumCursors += userContexts[j].getNumCursors();
      s += (j == 0 ? "" : "+") + userContexts[j].getNumCursors();
    }
    s += " contacts]";
    if (totalNumCursors > 0) {
      gw.setColor(0, 0, 0);
      gw.setFontHeight(Constant.TEXT_HEIGHT);
      gw.drawString(Constant.TEXT_HEIGHT, 2 * Constant.TEXT_HEIGHT, s);
    }
  }