[英]Unable to disable autofill on keyboard on iOS 15 swift. Xcode 13
[英]Xcode 6: iOS Swift. How to get in game frame rate (fps)?
在我当前的iOS Swift项目中,我需要在运行该设备的设备上将其除以当前FPS。 就我而言,该程序正在我的iPad mini上运行。 我没有看到执行此操作的功能或任何功能。 有任何想法吗? 提前致谢!
但是,“ GameViewController.swift”中有一行:
skView.showsFPS = true
但是我无法访问此值。
您可以在didMoveToView:(SKView *)view
方法中访问SKView frameInterval
属性。
如果值为1,则您正在运行60 FPS。 如果值为2,则您以30 FPS的速度运行。 别的,拿出您的计算器。
您可以在Apple SKView 文档中阅读更多详细信息。
您在GameViewController中设置FPS:
skView.frameInterval = 2;
将整数转换为浮点数:
int myInt = 10;
float myFloat = (float)myInt;
我以前从未使用过iOS,但是在android上,我在onDraw函数上使用了类似的方法:
dt = currentTime - lastTime;
lastTime = currentTime;
tempDt += dt;
fps += 1;
if (tempDt >= 1000) {
Log.d("FPS", String.format("%d", fps));
tempDt = 0;
fps = 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.