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

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

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

Graphics.getDeltaTime介绍

暂无

代码示例

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

private void animate () {
  delta = Gdx.graphics.getDeltaTime();
  instance.transform.val[14] += delta * 4 * dir;
  if (Math.abs(instance.transform.val[14]) > 5) {
    dir *= -1;
  }
}

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

@Override
public boolean scrolled (int amount) {
  cam.fieldOfView -= -amount * Gdx.graphics.getDeltaTime() * 100;
  cam.update();
  return true;
}

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

@Override
  public void render () {
    long frameTime = TimeUtils.nanoTime();
    float deltaTime = (frameTime - lastFrameTime) / 1000000000.0f;
    lastFrameTime = frameTime;

    Gdx.app.log("DeltaTimeTest", "delta: " + deltaTime + ", gdx delta: " + Gdx.graphics.getDeltaTime());
  }
}

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

public void render () {
  float delta = Math.max(0, Gdx.graphics.getDeltaTime() * deltaMultiplier.getValue());
  update(delta);
  renderWorld();
}

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

@Override
public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
  stage.draw();
}

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

@Override
protected void render (ModelBatch batch, Array<ModelInstance> instances) {
  for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries())
    e.value.update(Gdx.graphics.getDeltaTime());
  batch.render(instances, environment);
}

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

@Override
public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  ui.act(Gdx.graphics.getDeltaTime());
  ui.draw();
}

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

@Override
public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.act(Gdx.graphics.getDeltaTime());
  stage.draw();
}

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

public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.act(Gdx.graphics.getDeltaTime());
  stage.draw();
}

代码示例来源: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.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
  stage.draw();
}

代码示例来源: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.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
  stage.draw();
}

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

public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.act(Gdx.graphics.getDeltaTime());
  stage.draw();
}

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

@Override
public void render (Array<ModelInstance> instances) {
  dirLight.direction.rotate(dirLightRotAxis, Gdx.graphics.getDeltaTime() * 45f);
  super.render(null);
  for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries())
    e.value.update(Gdx.graphics.getDeltaTime());
  shaderBatch.begin(cam);
  shaderBatch.render(instances, environment);
  shaderBatch.end();
}

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

@Override
protected void render (ModelBatch batch, Array<ModelInstance> instances) {
  for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries())
    e.value.update(Gdx.graphics.getDeltaTime());
  for (final ModelInstance instance : instances)
    renderSkeleton(instance);
  batch.render(instances);
}

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

@Override
  public void render () {
    initialize();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
  }
}

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

@Override
public void update () {
  if (performanceCounter != null) {
    performanceCounter.tick();
    performanceCounter.start();
  }
  if (collisionWorld instanceof btDynamicsWorld)
    ((btDynamicsWorld)collisionWorld).stepSimulation(Gdx.graphics.getDeltaTime(), maxSubSteps, fixedTimeStep);
  if (performanceCounter != null) performanceCounter.stop();
}

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

public void render () {
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  drawn = 0;
  stage.act(Gdx.graphics.getDeltaTime());
  stage.draw();
  drawnLabel.setText("Drawn: " + drawn + "/" + count);
  drawnLabel.invalidateHierarchy();
}

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

@Override
public void render () {
  counter = (counter + Gdx.graphics.getDeltaTime()) % 2.f;
  testAttribute1.value = Math.abs(1f - counter);
  testAttribute2.value = 1f - testAttribute1.value;
  camController.update();
  Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
  modelBatch.begin(cam);
  modelBatch.render(instances);
  modelBatch.end();
}

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

@Override
public void begin (final Camera camera, final RenderContext context) {
  super.begin(camera, context);
  for (final DirectionalLight dirLight : directionalLights)
    dirLight.set(0, 0, 0, 0, -1, 0);
  for (final PointLight pointLight : pointLights)
    pointLight.set(0, 0, 0, 0, 0, 0, 0);
  for (final SpotLight spotLight : spotLights)
    spotLight.set(0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0);
  lightsSet = false;
  if (has(u_time)) set(u_time, time += Gdx.graphics.getDeltaTime());
}

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

public void render () {
  // System.out.println(meow.getValue());
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  stage.act(Gdx.graphics.getDeltaTime());
  stage.draw();
  stage.getBatch().begin();
  patch.draw(stage.getBatch(), 300, 100, 126, 126);
  stage.getBatch().end();
}

相关文章