@2474680742 写道:
在开始方法中我是这样写的
........
auto sence = MySence::create();
auto layer = MyFirstLayer::create();
sence->addChild(layer);
// run
director->runWithScene(sence);创建sence成功,但是layer创建失败/......
说是显示在layer变量的值显示<无可用信息,未为 libcocos2d_2015.dll 加载任何符号>附上我的MyFirstLayer.cpp
include"MyLayer.h"
MyFirstLayer* MyFirstLayer::creat() {
MyFirstLayer* alayer = new MyFirstLayer;
if (alayer&&alayer->init())
{
CCLOG("程序粗错1");
alayer->autorelease();
return alayer;
}
else
CC_SAFE_DELETE(alayer);
return NULL;
}bool MyFirstLayer::init()
{
if (!Layer::init()) {
CCLOG("程序粗错2");
return false;
}
Size size = Director::getInstance()->getVisibleSize();
Label* label = Label::createWithTTF("helloI'amAbao", "fonts/Marker Felt.ttf", 24);
label->setPosition(Vec2(size.width / 2, size.height /2));
this->addChild(label);
auto sprite = Sprite::create("timg.jpg");
sprite->setPosition(Vec2(size.width / 2, size.height / 2));
if(!sprite)
{
CCLOG("程序粗错3");
return false;
}
this->addChild(sprite);
return true;
}
帖子: 1
参与者: 1