com.badlogic.gdx.Graphics.getFramesPerSecond()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(237)

本文整理了Java中com.badlogic.gdx.Graphics.getFramesPerSecond()方法的一些代码示例,展示了Graphics.getFramesPerSecond()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics.getFramesPerSecond()方法的具体详情如下:
包路径:com.badlogic.gdx.Graphics
类名称:Graphics
方法名:getFramesPerSecond

Graphics.getFramesPerSecond介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

public void render (boolean update) {
  fpsCounter.put(Gdx.graphics.getFramesPerSecond());
  if (update) update();
  beginRender(true);
  renderWorld();
  Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
  if (debugMode != DebugDrawModes.DBG_NoDebug) world.setDebugMode(debugMode);
  Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
  performance.setLength(0);
  performance.append("FPS: ").append(fpsCounter.value).append(", Bullet: ")
    .append((int)(performanceCounter.load.value * 100f)).append("%");
}

代码示例来源:origin: libgdx/libgdx

protected void getStatus (final StringBuilder stringBuilder) {
  stringBuilder.append("FPS: ").append(Gdx.graphics.getFramesPerSecond());
  if (loading) stringBuilder.append(" loading...");
}

代码示例来源:origin: libgdx/libgdx

/** Logs the current frames per second to the console. */
  public void log () {
    if (TimeUtils.nanoTime() - startTime > 1000000000) /* 1,000,000,000ns == one second */{
      Gdx.app.log("FPSLogger", "fps: " + Gdx.graphics.getFramesPerSecond());
      startTime = TimeUtils.nanoTime();
    }
  }
}

代码示例来源:origin: libgdx/libgdx

/** Logs the current frames per second to the console. */
  public void log () {
    if (TimeUtils.nanoTime() - startTime > 1000000000) /* 1,000,000,000ns == one second */{
      Gdx.app.log("FPSLogger", "fps: " + Gdx.graphics.getFramesPerSecond());
      startTime = TimeUtils.nanoTime();
    }
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  fpsLabel.setText("fps: " + Gdx.graphics.getFramesPerSecond());
  stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
  stage.draw();
}

代码示例来源:origin: libgdx/libgdx

public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  batch.begin();
  sprite.draw(batch);
  font.draw(batch, "fps:" + Gdx.graphics.getFramesPerSecond(), 26, 65);
  batch.end();
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.draw();
  Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond());
  SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch();
  Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls);
  spriteBatch.totalRenderCalls = 0;
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.draw();
  Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond());
  SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch();
  Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls);
  spriteBatch.totalRenderCalls = 0;
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.draw();
  Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond());
  SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch();
  Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls);
  spriteBatch.totalRenderCalls = 0;
}

代码示例来源:origin: libgdx/libgdx

public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.draw();
  // check how many actors are visible.
  Array<Actor> actors = stage.getActors();
  int numVisible = 0;
  for (int i = 0; i < actors.size; i++) {
    numVisible += ((CullableActor)actors.get(i)).visible ? 1 : 0;
  }
  batch.begin();
  font.draw(batch, "Visible: " + numVisible + ", fps: " + Gdx.graphics.getFramesPerSecond(), 20, 30);
  batch.end();
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.55f, 0.55f, 0.55f, 1f);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  camera.update();
  renderer.setView(camera);
  renderer.render();
  batch.begin();
  font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20);
  batch.end();
}

代码示例来源:origin: libgdx/libgdx

@Override
  public void render () {
    Gdx.gl.glClearColor(100f / 255f, 100f / 255f, 250f / 255f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    renderer.setView(camera);
    renderer.render();
    batch.begin();
    font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20);
    batch.end();
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.55f, 0.55f, 0.55f, 1f);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  camera.update();
  renderer.setView(camera);
  renderer.render();
  batch.begin();
  font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20);
  batch.end();
}

代码示例来源:origin: libgdx/libgdx

@Override
  public void render () {
    Gdx.gl.glClearColor(0.55f, 0.55f, 0.55f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    renderer.setView(camera);
    renderer.render();
    batch.begin();
    font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20);
    batch.end();
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
  public void render () {
    Gdx.gl.glClearColor(100f / 255f, 100f / 255f, 250f / 255f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    renderer.setView(camera);
    renderer.render();
    batch.begin();
    font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20);
    batch.end();
  }
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.55f, 0.55f, 0.55f, 1f);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  camera.update();
  renderer.setView(camera);
  renderer.render();
  batch.begin();
  font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20);
  batch.end();
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.55f, 0.55f, 0.55f, 1f);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  camera.update();
  renderer.setView(camera);
  renderer.render();
  batch.begin();
  font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 10, 20);
  batch.end();
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClearColor(0.4f, 0.4f, 0.4f, 1f);
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
  modelBatch.begin(camera);
  modelBatch.render(voxelWorld, lights);
  modelBatch.end();
  controller.update();
  spriteBatch.begin();
  font.draw(spriteBatch, "fps: " + Gdx.graphics.getFramesPerSecond() + ", #visible chunks: " + voxelWorld.renderedChunks
    + "/" + voxelWorld.numChunks, 0, 20);
  spriteBatch.end();
}

代码示例来源:origin: libgdx/libgdx

public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  batch.setProjectionMatrix(sceneMatrix);
  batch.begin();
  renderSprite();
  batch.end();
  batch.setProjectionMatrix(textMatrix);
  batch.begin();
  font.draw(batch, modeString + " fps:" + Gdx.graphics.getFramesPerSecond(), 26, 65);
  batch.end();
}

代码示例来源:origin: libgdx/libgdx

@Override
public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  camera.update();
  batch.setProjectionMatrix(camera.combined);
  batch.begin();
  batch.draw(img2, -100, 0);
  batch.draw(img1, 0, 0);
  batch.end();
  batch.getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  batch.begin();
  font.draw(batch, "fps: " + Gdx.graphics.getFramesPerSecond(), 0, 30);
  batch.end();
}

相关文章