Beispiel #1
0
  /** Take a screenshot and save it using the current time as the file name. */
  public static void takeScreenshot() {
    Date now = new Date();
    SimpleDateFormat sdt = new SimpleDateFormat("yyyy.MM.dd-HH.mm.ss.SSS");

    String filename = "data\\screenshot_" + sdt.format(now) + ".png";

    PGraphics pg;
    pg = instance.createGraphics(instance.width, instance.height, P3D);
    pg.beginDraw();
    instance.draw();
    TouchClient.draw();
    PromptManager.draw();
    pg.endDraw();

    if (pg.save(filename)) LOGGER.info("Screenshot saved: " + filename);
    else LOGGER.error("Failed to save screenshot.");
  }