Example #1
0
  @Override
  public void dispose() {
    if (currentTest != null) currentTest.dispose();

    stage.dispose();
    skin.dispose();
  }
Example #2
0
  @Override
  public void render() {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    fpsStringBuilder.setLength(0);
    getStatus(fpsStringBuilder);
    fpsLabel.setText(fpsStringBuilder);

    if (currentTest != null) currentTest.render();

    stage.act();
    stage.draw();
  }
Example #3
0
  void changeTest(int behaviorIndex) {
    // Remove the old behavior and its window
    testsTable.clear();
    if (currentTest != null) {
      if (currentTest.getDetailWindow() != null) currentTest.getDetailWindow().remove();
      currentTest.dispose();
    }

    // Add the new behavior and its window
    currentTest = tests[behaviorIndex];
    Gdx.app.log("BehaviorTreeTests", "***********************************************");
    Gdx.app.log("BehaviorTreeTests", "Starting test " + currentTest.getClass().getSimpleName());
    Gdx.app.log("BehaviorTreeTests", "***********************************************");
    String description = currentTest.getDescription();
    if (description != null) {
      Gdx.app.log("BehaviorTreeTests", description);
      Gdx.app.log("BehaviorTreeTests", "***********************************************");
    }
    currentTest.create(testsTable);
    InputMultiplexer im = (InputMultiplexer) Gdx.input.getInputProcessor();
    if (im.size() > 1) im.removeProcessor(1);
    if (currentTest.getInputProcessor() != null) im.addProcessor(currentTest.getInputProcessor());
    if (currentTest.getDetailWindow() != null) stage.addActor(currentTest.getDetailWindow());
  }