Exemple #1
0
 private static void drawDebug(Array<Actor> actors, Batch batch) {
   for (int i = 0, n = actors.size; i < n; i++) {
     Actor actor = actors.get(i);
     if (!actor.isVisible()) continue;
     if (actor instanceof Table) ((Table) actor).layout.drawDebug(batch);
     if (actor instanceof Group) drawDebug(((Group) actor).getChildren(), batch);
   }
 }
  protected void debugDrawUI() {
    if (Env.debug) {
      if (Env.drawFPS) {
        String fpsText = String.format("%d FPS", Gdx.graphics.getFramesPerSecond());
        TextBounds bounds = debugFont.getBounds(fpsText);
        batch.setProjectionMatrix(uiCamera.combined);
        batch.begin();
        debugFont.setColor(1.0f, 1.0f, 1.0f, 1.0f);
        debugFont.draw(batch, fpsText, uiViewport.getWorldWidth() - bounds.width - 20.0f, 20.0f);
        batch.end();
      }

      Table.drawDebug(Env.game.getStage());
    }
  }
Exemple #3
0
  @Override
  public void render(float gameTime) {
    Gdx.gl.glClearColor(1, 1, 1, 1.0f);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    if (debugEnable) {
      debugRebuildStage -= gameTime;
      if (debugRebuildStage <= 0) {
        debugRebuildStage = DEBUG_REBUILD_INTERVAL;
        rebuildStage();
      }
    }

    stage.act(gameTime);
    stage.draw();
    Table.drawDebug(stage);
  }
  @Override
  public void render(float delta) {
    // (1) process the game logic

    // update the actors
    stage.act(delta);

    // (2) draw the result

    // clear the screen with the given RGB color (black)
    Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // draw the actors
    stage.draw();

    // draw the table debug lines
    Table.drawDebug(stage);
  }
 public void render() {
   Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   stage.act(Gdx.graphics.getDeltaTime());
   stage.draw();
   Table.drawDebug(stage);
 }
Exemple #6
0
 public void render() {
   stage.draw();
   Table.drawDebug(stage);
 }
Exemple #7
0
 /**
  * Draws the debug lines for all tables in the stage. If this method is not called each frame, no
  * debug lines will be drawn. If debug is never turned on for any table in the application,
  * calling this method will have no effect. If a table has ever had debug set, calling this method
  * causes an expensive traversal of all actors in the stage.
  */
 public static void drawDebug(Stage stage) {
   if (!TableToolkit.drawDebug) return;
   drawDebug(stage.getActors(), stage.getSpriteBatch());
 }