摩托罗拉xoom上的Cocos2d android Texture问题 [英] Cocos2d android Texture issue on Motorola xoom

查看:194
本文介绍了摩托罗拉xoom上的Cocos2d android Texture问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Cocos2d框架在android中开发游戏,其最新版本来自github(Weikuan Zhou).

I am developing a game in android with Cocos2d framework with latest build from github(Weikuan Zhou).

在我的游戏中,我使用了很多图像(总图像大小约为11MB).

In my game, I used lots of images(total images size is around 11MB).

问题: 玩游戏超过3次后,我得到的是黑匣子,而不是图像.

Problem: I am getting the black box instead of images when I play my game more than 3 times.

哪些步骤将重现该问题? 1.当我通过游戏的再次播放"功能玩了3次以上游戏时.

What steps will reproduce the problem? 1. When I play my game more than 3 times via "Play Again" functionality of my game.

预期输出是多少?你看到了什么呢? -图像应正确显示,而不要显示"BLACK BOX".

What is the expected output? What do you see instead? - images should be displayed properly instead of "BLACK BOX".

在我的logcat中,我看到堆内存在13Mb左右.

and in my logcat, I see the Heap memory goes around 13Mb.

  • 我已经通过以下方法释放了纹理

CCTextureCache.sharedTextureCache().removeAllTextures();

CCTextureCache.sharedTextureCache().removeAllTextures();

我也尝试过手动删除精灵. removeChild()方法.

I also tried to remove sprite manually ex. removeChild() method.

但是到目前为止,没有找到任何解决方案.

But so far not succeeding to find any solution.

如果有人对此有解决方案,请告诉我.

If any one have solution for this please let me know.

推荐答案

在运行时加载资源时会发生此问题.因此最好在场景开始之前加载资源.您可以执行以下操作.

This problem happens when you load resources at run time. So it is better to load resources before the scene starts.You can do as follows.

  1. 使用精灵表获取游戏中的资源.
  2. 在类的构造函数中实现Ui.
  3. 在图层的onEnter()覆盖方法中实现您的功能.
  4. 完成场景后,您必须卸载精灵板.

这些是我要遵循的过程. 谢谢.

These is the procedure that I am following. Thanks.

这篇关于摩托罗拉xoom上的Cocos2d android Texture问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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