FPSCounter.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:ShapeClear 作者:
@Override
public void draw(Batch batch,float parentAlpha){

    AssetLoader.font.getData().setScale(getScaleX());
    timer+=Gdx.graphics.getDeltaTime();
    FPSCount++;

    String text="FPS: "+fps;
    GlyphLayout layout=new GlyphLayout();
    layout.setText(AssetLoader.font, text);
    float height=layout.height;
    AssetLoader.font.draw(batch, text, 0, height);

    if(FPSCount>=60)
    {
        fps=(int) ((float)FPSCount/timer);
        timer=0;
        FPSCount=0;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号