C++ kResolutionFixedHeight错误(cocos2d-x 2.3.3)

C++ kResolutionFixedHeight错误(cocos2d-x 2.3.3),c++,cocos2d-x,levelhelper,C++,Cocos2d X,Levelhelper,我正在做一个游戏,应该有一个恒定的高度(480.0) 所以我写了下面的代码。。 问题是我的精灵床单功率是2秒 对于sd来说,这里是正常的图像,对于hd来说是两倍大小,对于iPad视网膜来说是4倍大; 因此,在这种情况下,当我从场景中绘制精灵时,图像没有正确绘制。。 我猜这是因为CCSpriteFrame使用CC_ContentScaleFactor()来计算图像的帧,它剪切了错误的帧 有人知道怎么解决吗 CCSize designResolutionSize = CCSize(320,480);

我正在做一个游戏,应该有一个恒定的高度(480.0) 所以我写了下面的代码。。 问题是我的精灵床单功率是2秒 对于sd来说,这里是正常的图像,对于hd来说是两倍大小,对于iPad视网膜来说是4倍大; 因此,在这种情况下,当我从场景中绘制精灵时,图像没有正确绘制。。 我猜这是因为CCSpriteFrame使用CC_ContentScaleFactor()来计算图像的帧,它剪切了错误的帧

有人知道怎么解决吗

CCSize designResolutionSize = CCSize(320,480);
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

pDirector->setOpenGLView(pEGLView);

pEGLView->setDesignResolutionSize(designResolutionSize.width,
                                  designResolutionSize.height,
                                  kResolutionFixedHeight);

CCSize size = CCEGLView::sharedOpenGLView()->getFrameSize();

std::vector<std::string> res;
if(size.width >= 2048 || size.height >= 2048){
    res.push_back("ipadhd");
}
else if(size.width >= 960 || size.height >= 960){
    res.push_back("hd");
}
else {
    res.push_back("sd");
}

CCFileUtils::sharedFileUtils()->setSearchPaths(res);
CCDirector::sharedDirector()->setContentScaleFactor(size.height / designResolutionSize.height);
CCSize designResolutionSize=CCSize(320480);
CCDirector*pDirector=CCDirector::sharedDirector();
CCEGLView*pEGLView=CCEGLView::SharedPenglView();
pddirector->setOpenGLView(pEGLView);
pEGLView->setDesignResolutionSize(designResolutionSize.width,
设计分辨率大小。高度,
Kresolution固定高度);
CCSize size=CCEGLView::SharedPenglView()->getFrameSize();
std::向量res;
如果(size.width>=2048 | | size.height>=2048){
res.push_back(“ipadhd”);
}
否则如果(size.width>=960 | | size.height>=960){
res.push_back(“hd”);
}
否则{
res.push_back(“sd”);
}
CCFileUtils::sharedFileUtils()->SetSearchPath(res);
CCDirector::sharedDirector()->setContentScaleFactor(size.height/designResolutionSize.height);

谢谢你,乔治。

为了确保你已经经历了:这是一个错误。。。所以我用了另一个解决方案,你好,你是如何解决你的问题的?我对cocos2d-X2.2.3和levelhelper 1.4.989也有同样的问题,我已经解决了重新编写levelhelper加载程序代码的问题。我支持cocos2d-x的多分辨率系统和所有工作。kResolutionFixedHeight有一些不好的结果,因此我不得不使用kResolutionNoBorder,并且在更改内容比例因子时SpriteBatchNodes不工作。。