예제 #1
0
  /** Resume the application. */
  public static void resumeApplication() {
    if (state == ApplicationState.PAUSED) {
      PromptManager.resume();
    } else if (state == ApplicationState.IDLE) {
      LOGGER.info("Application was resumed from idle state");
      PromptManager.reset();
    }

    state = ApplicationState.RUNNING;
  }
예제 #2
0
 /**
  * This method should be called each time user touched the screen. It tracks saves the time of the
  * last action, which helps to determine how long the application has been inactive.
  */
 public static void setActionPerformed() {
   if (state == ApplicationState.IDLE) {
     state = ApplicationState.RUNNING;
     PromptManager.reset();
   }
   lastActionTime = System.currentTimeMillis();
 }
예제 #3
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.");
  }
예제 #4
0
  /** Reset the workspace to defaults: clear the workspace and then load the default layout. */
  public static void resetToDefaults() {
    LOGGER.info("Reset workspace and load defaults.");
    clearWorkspace();
    loadLayout(Settings.dataFolder + Settings.defaultLayoutFile);
    // Put drawers on top
    if (leftDrawer != null) TouchClient.putZoneOnTop(leftDrawer);
    if (rightDrawer != null) TouchClient.putZoneOnTop(rightDrawer);
    if (topDrawer != null) {
      TouchClient.putZoneOnTop(topDrawer);
    }

    setSelectedBrush(getAllBrushes().get(0));
    setSelectedPaint(getAllPaints().get(0));
    setActionPerformed();

    PromptManager.reset();
    idleApplication();
  }
예제 #5
0
  /**
   * Load a save file, including the layout and painting.
   *
   * @param save SaveFile object to load data from
   */
  public static void loadSave(SaveFile save) {
    LOGGER.info("Loading a save file " + save.filename);

    clearWorkspace();
    loadLayout(save.layoutPath);
    canvas.clearAndLoad(save.drawingPath);

    // Put drawers on top
    if (leftDrawer != null) TouchClient.putZoneOnTop(leftDrawer);
    if (rightDrawer != null) TouchClient.putZoneOnTop(rightDrawer);
    if (topDrawer != null) {
      TouchClient.putZoneOnTop(topDrawer);
    }

    setSelectedBrush(getAllBrushes().get(0));
    setSelectedPaint(getAllPaints().get(0));

    PromptManager.reset();
  }
예제 #6
0
  /**
   * Perform the initial setup: set size, initialise TouchClient, load GUI and layout, initialise
   * PromptManager and TTSManager.
   */
  @Override
  public void setup() {
    size(Settings.width, Settings.height, P3D);
    frameRate(Settings.targetFPS);
    LOGGER.info(
        "Application started with parameters: width="
            + Settings.width
            + ", height="
            + Settings.height
            + ", fps="
            + Settings.targetFPS);

    instance = this;

    font = createDefaultFont(20);

    // Figure out the touch source
    TouchSource source;
    String sourceString = Settings.touchSourse.toUpperCase();
    if ("TUIO_DEVICE".equals(sourceString)) source = TouchSource.TUIO_DEVICE;
    else if ("MOUSE".equals(sourceString)) source = TouchSource.MOUSE;
    else if ("WM_TOUCH".equals(sourceString)) source = TouchSource.WM_TOUCH;
    else if ("ANDROID".equals(sourceString)) source = TouchSource.ANDROID;
    else if ("SMART".equals(sourceString)) source = TouchSource.SMART;
    else source = TouchSource.MOUSE;

    TouchClient.init(this, source);
    TouchClient.setWarnUnimplemented(false);
    // TouchClient.setTouchDraw(TouchDraw.SMOOTH, 0);
    TouchClient.setDrawTouchPoints(TouchDraw.SMOOTH, 0);

    loadGUI();
    loadLayout(Settings.dataFolder + Settings.defaultLayoutFile);

    PromptManager.init(this);
    TTSManager.init();
    setActionPerformed();
    state = ApplicationState.IDLE;
    SplashScreen.remove();
  }
예제 #7
0
 /** Put the application into idle state. */
 public static void idleApplication() {
   LOGGER.info("Application is idle");
   state = ApplicationState.IDLE;
   PromptManager.pause();
 }
예제 #8
0
 /** Pause the application. */
 public static void pauseApplication() {
   state = ApplicationState.PAUSED;
   PromptManager.pause();
 }