尝试确定C#WPF程序中的FPS [英] Trying to determine FPS in a C# WPF program

查看:298
本文介绍了尝试确定C#WPF程序中的FPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WPF和C#为触摸表编写应用程序. (而且,我对WPF并不十分熟悉.)我们怀疑我们没有从API获得"所请求的帧率,所以我试图编写自己的FPS计算器.我知道基于内部时钟进行计算的数学方法,只是不知道如何在Windows/WPF API中访问计时器.

I'm writing an application for a touch table using WPF and C#. (And, I'm not terribly familiar with WPF. At all.) We suspect we're not getting the framerate we're "requesting" from the API so I'm trying to write my own FPS calculator. I'm aware of the math to calculate it based on the internal clock, I just don't know how to access a timer within the Windows/WPF API.

访问计时器需要什么库/命令?

What library/commands do I need to get access to a timer?

推荐答案

我认为您正在寻找

I think you're looking for the StopWatch. Just initialize it and reset it with each start of your iteration. At the end of an iteration, do your calculation.

这篇关于尝试确定C#WPF程序中的FPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆