Calculating frames per second in a game

后端 未结 19 756
天命终不由人
天命终不由人 2020-12-04 05:10

What\'s a good algorithm for calculating frames per second in a game? I want to show it as a number in the corner of the screen. If I just look at how long it took to render

19条回答
  •  一个人的身影
    2020-12-04 05:40

    store a start time and increment your framecounter once per loop? every few seconds you could just print framecount/(Now - starttime) and then reinitialize them.

    edit: oops. double-ninja'ed

提交回复
热议问题