cocoswin32显示不出UI

bool HelloWorld::init()
{
COCOUISYSTEM->init();
COCOUISYSTEM->resetSystem(this);

COCOUISYSTEM->replaceUISceneWithFile(this,“DemoHead_UI.json”, 1, false);

CocoButton* exitbutton=CocoButton::create();
exitbutton->setTextures(“CloseNormal.png”,“CloseSelected.png”,"");
exitbutton->setPosition(ccp(460,60));
COCOUISYSTEM->getCurScene()->addWidget(exitbutton);
return true;
}

资源放在了resource里面了 但是代码做的按钮画出来了,studio导出的DemoHead_UI.json却没有出来,会是什么问题?本人刚刚学习,烦请各位不吝赐教。

你的图片加进去了么?看你渲染次数是1,ui使用的图片都没加载进去哦,可以看看log里面输出了什么错误,是不是没有找到资源。。

图片加进去了
sceneRootWidget = this->createWidgetFromFile_json(fileName); 这个貌似没有读到资源。。。
但是图片和json文件确实放在resource里面了 难道还有其他操作?

CocoWidget* CCSReader::widgetFromJsonFile(const char *fileName)
{
const char des = NULL;
std::string jsonpath;
std::string doc;
cs::CSJsonDictionary jsonDict = NULL;
jsonpath = cocos2d::CCFileUtils::sharedFileUtils()->fullPathForFilename(fileName);
std::ifstream ifs;
ifs.open(jsonpath.c_str());
std::getline(ifs, doc, (char)EOF);
des = doc.c_str();
ifs.close();
jsonDict = new cs::CSJsonDictionary();
jsonDict->initWithDescription(des);
if(NULL == des || strcmp(des, “”) == 0)
{
printf(“read json file%s] error!\n”, fileName);
}
float fileVersion = DICTOOL->getFloatValue_json(jsonDict, “version”);
if (fileVersion != kCCSVersion) {
printf(“WARNING! Incompatible json file version (file: %f reader: %f)\n”, fileVersion, kCCSVersion);
return NULL;
}
int texturesCount = DICTOOL->getArrayCount_json(jsonDict, “textures”);
for (int i=0; i<texturesCount; i++) {
const char
file = DICTOOL->getStringValueFromArray_json(jsonDict, “textures”, i);
COCOUISYSTEM->addSpriteFrame(file);
}
float fileDesignWidth = DICTOOL->getFloatValue_json(jsonDict, “designWidth”);
float fileDesignHeight = DICTOOL->getFloatValue_json(jsonDict, “designHeight”);
if (fileDesignWidth <= 0 || fileDesignHeight <= 0) {
printf(“Read design size error!\n”);
cocos2d::CCSize winSize = cocos2d::CCDirector::sharedDirector()->getWinSize();
UISystem::shareSystem()->setFileDesignWidth(winSize.width);
UISystem::shareSystem()->setFileDesignHeight(winSize.height);
}else{
UISystem::shareSystem()->setFileDesignWidth(fileDesignWidth);
UISystem::shareSystem()->setFileDesignHeight(fileDesignHeight);
}
cs::CSJsonDictionary
widgetTree = DICTOOL->getSubDictionary_json(jsonDict, “widgetTree”);
return this->widgetFromJsonDictionary(widgetTree);
}
请教各位大大 是不是CCSReader.cpp里面的问题 sceneRootWidget空指针 请问哪能下到最新的 CocoGUILIB

你可以搜索下帖子,我记得有个帖子也说了这个问题

难道是版本问题?cocos2d-x-2.2 vs2012 CocoStudio_Full_V1.0.2.0

救命撒好几天了,停在这里,帖子没找到的说,谁有 CocoGUILIB 或者CocoStuioTestCPP.sln 给我一份吧 感激~