3.7版本cocos2d-x不能在Scene的init里增加多个成员Layer???一增加就崩溃,
难道是我哪里出错了?
问题解决了
http://www.cocoachina.com/bbs/read.php?tid=326092&page=1&toread=1#tpc
3.7版本cocos2d-x不能在Scene的init里增加多个成员Layer???一增加就崩溃,
难道是我哪里出错了?
问题解决了
http://www.cocoachina.com/bbs/read.php?tid=326092&page=1&toread=1#tpc
能啊,怎么不能,一定是你的电脑有问题
现在是自定义的Scene都会崩溃,
1.
class MainScene : public cocos2d::Scene
{
public:
CREATE_FUNC(MainScene);
};
2.在applicationDidFinishLaunching()
director->runWithScene(MainScene::create());
3.运行启动后就退出就崩溃这里
void Ref::release()
{
CCASSERT(_referenceCount > 0, “reference count should be greater than 0”);
–_referenceCount;
if (_referenceCount == 0)
{
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
auto poolManager = PoolManager::getInstance();
if (!poolManager->getCurrentPool()->isClearing() && poolManager->isObjectInPools(this))
{
// Trigger an assert if the reference count is 0 but the Ref is still in autorelease pool.
// This happens when ‘autorelease/release’ were not used in pairs with ‘new/retain’.
//
// Wrong usage (1):
//
// auto obj = Node::create(); // Ref = 1, but it’s an autorelease Ref which means it was in the autorelease pool.
// obj->autorelease(); // Wrong: If you wish to invoke autorelease several times, you should retain obj first.
//
// Wrong usage (2):
//
// auto obj = Node::create();
// obj->release(); // Wrong: obj is an autorelease Ref, it will be released when clearing current pool.
//
// Correct usage (1):
//
// auto obj = Node::create();
// |- new Node(); // new is the pair of the autorelease of next line
// |- autorelease(); // The pair of new Node.
//
// obj->retain();
// obj->autorelease(); // This autorelease is the pair of retain of previous line.
//
// Correct usage (2):
//
// auto obj = Node::create();
// obj->retain();
// obj->release(); // This release is the pair of retain of previous line.
CCASSERT(false, “The reference shouldn’t be 0 because it is still in autorelease pool.”);
}
#endif
#if CC_REF_LEAK_DETECTION
untrackRef(this);
#endif
delete this;
}
}
完全搞不明白,help please
你自定义的scene里没有init方法,也没有静态创建场景函数,你仔细看HelloWorld.h的头文件,你少了好多函数
你最好截图,把问题说清楚,贴代码太乱了,还有,你用的是哪个版本,你可能太新手了