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

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

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

Graphics.getRawDeltaTime介绍

暂无

代码示例

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

@Override
public void update () {
  float delta = Gdx.graphics.getRawDeltaTime();
  time += delta;
  super.update();
  if (contactCache != null) contactCache.update(delta);
}

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

@Override
public void render () {
  transform.idt();
  if (rotateCheckBox.isChecked())
    transform.rotate(Vector3.Y, rotation = (rotation + rotationSpeed * Gdx.graphics.getRawDeltaTime()) % 360);
  if (moveCheckBox.isChecked()) {
    movement = (movement + moveSpeed * Gdx.graphics.getRawDeltaTime()) % 1f;
    final float sm = MathUtils.sin(movement * MathUtils.PI2);
    final float cm = MathUtils.cos(movement * MathUtils.PI2);
    transform.trn(0, moveRadius * cm, moveRadius * sm);
  }
  super.render();
  stringBuilder.setLength(0);
  getStatus(stringBuilder);
  fpsLabel.setText(stringBuilder);
  hud.act(Gdx.graphics.getDeltaTime());
  hud.draw();
}

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

elapsed = 0;
} else {
  elapsed += Gdx.graphics.getRawDeltaTime();
  if (elapsed > 0.2f) {
    unload();

代码示例来源:origin: manuelbua/uracer-kotd

private long getDeltaTimeNs () {
  long delta = 0;
  if (!resumed) {
    if (useRealFrametime) {
      // this is not good for Android since the value often hop around
      delta = (long)(Gdx.graphics.getRawDeltaTime() * 1000000000f);
    } else {
      delta = (long)(Gdx.graphics.getDeltaTime() * 1000000000f);
    }
  } else {
    // if just resumed, then pick up the last delta time before pause
    delta = lastDeltaTimeNsBeforePause;
    resumed = false;
  }
  // avoid spiral of death
  return AMath.clamp(delta, 0, MaxDeltaTimeNs);
}

代码示例来源:origin: dingjibang/GDX-RPG

public static void act() {
  float delta = Gdx.graphics.getRawDeltaTime();
  if(!addList.isEmpty()){
    list.addAll(addList);
    addList.clear();
  }
  if(!list.isEmpty()){
    List<Task> removeList = new ArrayList<>();
    for(Task timer : list){
      if((timer.type == TimeType.frame && timer.time -- < 0) || (timer.type == TimeType.millisecond && (timer.time -= delta * 1000) < 0)){
        timer.run.run();
        if(timer.repeat != FOREVER &&  -- timer.repeat == 0)
          removeList.add(timer.done());
        else
          timer.time = timer.originTime;
      }
    }
    list.removeAll(removeList);
  }
  //更新当前存档进行时间
  if(Game.archive.has() && !pause)
    Game.archive.get().time += delta * 1000;
}

代码示例来源:origin: jmrapp1/SpaceInvaders

public void render(SpriteBatch sb) {
  if (flicker) {
    float dt = Gdx.graphics.getRawDeltaTime();
    zAngle += dt * zSpeed;
    while(zAngle > PI2)
      zAngle -= PI2;
  }
  float lightSize = flicker ? (size + 2.25f * (float)Math.sin(zAngle) + 2.2f*MathUtils.random()): size;
  sb.draw(ResourceManager.getInstance().getTexture("light"), pos.x - lightSize*0.5f + 0.5f, pos.y - lightSize*0.5f, lightSize, lightSize);
}

相关文章