为什么在SKView上设置frameInterval无效? [英] Why does setting frameInterval on a SKView not work?

查看:171
本文介绍了为什么在SKView上设置frameInterval无效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将帧率降低到最大30 FPS.官方文档说要使用:

I'm trying to reduce the framerate to a maximum of 30 FPS. The official documentation says to use:

skView.frameInterval = 2;

我通读了所有可用的文档以及这里在stackoverflow或其他页面/博客/等中提出的每个类似问题.我以多种方式进行了尝试,但是无论我在哪里尝试设置该属性都不会影响FPS.

I read through all the available documentations as well as every similar question asked here on stackoverflow or in other pages/blogs/etc. I tried it in so many ways but where ever I tried to set the property it did not affect the FPS.

除了SpriteKit的计时机制外,我没有使用其他计时机制.我正在根据文档和此处的Stackoverflow上的答案进行相应的设置.

I am not using any other timing mechanisms than those from SpriteKit. I am setting it up accordingly to the documentation and to the answers here on Stackoverflow.

我什至启动了Xcode随附的基本SpriteKit模板,并尝试设置帧速率属性,但即使这样也无法解决.

I even started the basic SpriteKit template provided with Xcode and tried to set the frame rate property but even that did not work out.

有人遇到任何相似之处吗?是否有降低最大fps的替代方法?我还能尝试减少FPS吗?

Does anyone experience any similarities? Is there an alternative way to reduce max fps? What else can I try to reduce FPS?

顺便说一句:我正在OS X上运行,并且拥有第一代Retina Macbook Pro-也许是硬件问题?

BTW.: I am working on OS X and have a first-gen Retina Macbook Pro - Maybe it's a hardware issue?

我没有重写-(void)update:方法-仅-(void)didSimulatePhysics

这是我在Interface Builder中设置的NSViewController子类中所做的. self.spriteKitView是我的NSViewController -Subclass

This is what I do in a NSViewController Subclass which I set in Interface Builder. self.spriteKitView is an outlet to the NSView of my NSViewController-Subclass

-(void)setupSpriteKitView {

    self.spriteKitView.frameInterval = 2;
    self.spriteKitView.ignoresSiblingOrder = YES;
    self.spriteKitView.showsFPS = YES;
    self.spriteKitView.showsDrawCount = YES;
    self.spriteKitView.showsNodeCount = YES;
}

-(void)viewDidLoad {

    [super viewDidLoad];
    [self setupSpriteKitView];
    [self loadStartupScene];
}

我什至试图将其放入我的SKScene-Subclass中,并将其作为用户属性附加到Interface Viewer中到SKView.

I even tried to put this into my SKScene-Subclass, attach it as user-property inside Interface Builder to the SKView.

我现在怎么不工作?在我的游戏和Xcode模板中,调试输出均显示60 FPS.即使减小skView.frameInterval = 4,动画也可以保持平滑.

How I now it's not working? Both in my game and the Xcode template the debug output says 60 FPS. And even when reducing skView.frameInterval = 4 the animations stay smooth.

推荐答案

好!由于工作时间确定了我做错了什么,所以我测试了Xcode SpriteKit模板.令人惊讶的是,即使此Apple提供的示例代码也不会对skView.frameInterval属性产生反应.

Ok! Since working hours on that figuring out what I am doing wrong I tested the Xcode SpriteKit template. Surprisingly even this Apple provided sample code does not react on the skView.frameInterval property.

因此,我想到了一个硬件错误,并在苹果论坛上进行了搜索.我发现有些人抱怨同样的问题,而且令人惊讶的是,苹果公司确实了解到该 FPS-Bug ,并将用 el capitan 进行修复...希望...我要测试开发者的预发行版!

So I was thinking of a hardware bug and searched the apple forums for that. What I found were a few people complaining about the same problem and surprisingly Apple does know about that FPS-Bug and will fix that in el capitan ... Hopefully ... I'm going to test the dev prerelease!

但是 os x 上的SpriteKit中还有很多错误!例如,当将窗口切换到全屏模式时,FPS会偶尔散布(ems )不确定的数量.有点搞砸了!

However, there are quite some more bugs in SpriteKit on os x! For example when switching a window into fullscreen the FPS drop sporadically by an undefined amount. It's a bit messed up!

由于@EpicByte,我找到了一些原因和答案.在上面的评论中查看他的解释!

Thanks to @EpicByte I found some reasons and answers. See his explanation in the comments above!

这篇关于为什么在SKView上设置frameInterval无效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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