简体   繁体   English

为什么全屏透明按钮在cocos2d-iphone上将fps从60降到30,我该如何解决它?

[英]Why does a fullscreen transparent button drop fps from 60 to 30 on cocos2d-iphone and how do I work around it?

I have a cclayer class with invisible button that is the size of the iphone 320x480 screen. 我有一个cclayer类,带有隐形按钮,大小与iphone 320x480屏幕相同。

I've set it to have the visible property so that when the user taps on any part of the screen, it'll set itself to invisible and set the rest of my ccmenuitems to be visible. 我已将其设置为具有可见属性,以便当用户点击屏幕的任何部分时,它将自己设置为不可见并将其余的ccmenuitems设置为可见。

I noticed that when the transparentbutton is 'visible' my fps drops to 30. When it toggles to be invisible and brings up the other 'visible' ccmenuitems, my fps goes back to 60fps. 我注意到当透明按钮“可见”时,我的fps下降到30.当它切换为不可见并带出其他“可见”的ccmenuitems时,我的fps会回到60fps。

Why does my app do this when there is a full screen transparent button and how do i work around this to maintain 60 fps? 为什么我的应用程序在有全屏透明按钮时执行此操作,我如何解决此问题以维持60 fps?

Transparent things are costly to render, as it requires calculating the net effect after applying the transparency. 透明的东西渲染成本很高,因为它需要在应用透明度后计算净效果。 Even if the view is full transparent (ie visible but alpha = 0), I guess these calculations are carried on. 即使视图是完全透明的(即可见但alpha = 0),我猜这些计算仍在继续。 Full screen transparency might affect the performance. 全屏透明度可能会影响性能。 Instead of using invisible button try to detect the touch in some other way, if possible. 如果可能的话,不要使用隐形按钮尝试以其他方式检测触摸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM