English 中文(简体)
当游戏活动恢复时,与 Coco2d-android发生分裂
原标题:Framedrops with Cocos2d-android when the game activity resumes

I m trying out some game engines for android and came across cocos2d-android-1. I ve set up a small example that pretty much does nothing except to show a FPS counter to start with.

The problem is that every time the activity goes to the background (via the home or back key) and comes back, the FPS drop a lot. At the first start they are around 60 for me (HTC Desire), after resuming the activity they stay below 10.

这项活动固定在标识中,并使用@android:e/Theme.Black.NoTitle Bar.Fulleen ,以便采用完整的筛选方式。

当我停止在装置环境中从应用菜单中取回时,它会照搬一切。 第一次发射再次出现60个浮点,次发射也有所下降。

我如何确定这一点?

这里是一个小型的工作样本:

public class MainActivity extends Activity {

    private CCGLSurfaceView glSurfaceView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        glSurfaceView = new CCGLSurfaceView(this);
        setContentView(glSurfaceView);
    }

    @Override
    public void onStart() {
        super.onStart();

        CCDirector.sharedDirector().attachInView(glSurfaceView);
        CCDirector.sharedDirector().setDisplayFPS(true);
    }

    @Override
    public void onPause() {
        super.onPause();

        CCDirector.sharedDirector().pause();
    }
}
最佳回答

Ok fixed it. Apparently I forgot to call resume() on the director. Added this to the above code and it works fine:

@Override
public void onResume() {
    super.onResume();
    CCDirector.sharedDirector().resume();
}
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签