What’s the code in your AppDelegate.cpp ? By that I mean when you set CCFileUtils::sharedFileUtils()->setResourceDirectory and the CCDirector content scale factor.
What’s the code in your AppDelegate.cpp ? By that I mean when you set CCFileUtils::sharedFileUtils()>setResourceDirectory and the CCDirector content scale factor.
Hi Francois:
Here is my code in AppDelegate.cpp
bool AppDelegate::applicationDidFinishLaunching {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector;
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView;
pDirector>setOpenGLView(pEGLView);
// Set the design resolution
pEGLView~~>setDesignResolutionSize;
CCSize frameSize = pEGLView~~>getFrameSize();
vector searchPath;
// In this demo, we select resource according to the frame’s height.
// If the resource size is different from design resolution size, you need to set contentScaleFactor.
// We use the ratio of resource’s height to the height of design resolution,
// this can make sure that the resource’s height could fit for the height of design resolution.
// if the frame’s height is larger than the height of medium resource size, select large resource.
if (frameSize.height > mediumResource.size.height)
{
searchPath.push_back(largeResource.directory);
////pDirector~~>setContentScaleFactor);
pDirector~~>setContentScaleFactor(largeResource.size.height/designResolutionSize.height);
}
// if the frame’s height is larger than the height of small resource size, select medium resource.
else if (frameSize.height > smallResource.size.height)
{
searchPath.push_back(mediumResource.directory);
pDirector~~>setContentScaleFactor);
}
// if the frame’s height is smaller than the height of medium resource size, select small resource.
else
{
searchPath.push_back;
pDirector~~>setContentScaleFactor(MIN (smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width));
}
// set searching path
CCFileUtils::sharedFileUtils()>setSearchPaths;
// turn on display FPS
pDirector>setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don’t call this
pDirector~~>setAnimationInterval;
// create a scene. it’s an autorelease object
//CCScene pScene = HelloWorld::scene;
MainMenuScenepScene = new MainMenuScene;
pScene~~>runScene();
// run
pDirector->runWithScene(pScene);
return true;
}
There is a problem with the code you copy-pasted. But anyway, can you confirm, using breakpoints, of the 3 “searchPath.push_back”, only the one with largeResource.directory is called ?
Another important thing : which cocos2d-x version are you running ?
The cocos2d-x is 2.1.2 version and cocosBuilder is 3.0
François Dupayrat wrote:
There is a problem with the code you copy-pasted. But anyway, can you confirm, using breakpoints, of the 3 “searchPath.push_back”, only the one with largeResource.directory is called ?
>
Another important thing : which cocos2d-x version are you running ?
Seems I won’t be able to help you much more, since I use cocos2d-x 2.0.4 and CocosBuilder 2.1.
Just a last thought : on CocosBuilder, did you properly set your sprite scale on multiply by resolution scale ? The problem may be that it loads the right sprite, but the scale is wrong. You can also manually check the sprite scale at runtime to make sure of this.
Thank you Francois, You are the only replied my question. I asked on cocos2d-iphone and stackoverflow too. But it seems like no one had the experience with the latest release.
I will continue dig down more and if I find the solution, I will post it here.
François Dupayrat wrote:
Seems I won’t be able to help you much more, since I use cocos2d-x 2.0.4 and CocosBuilder 2.1.
>
Just a last thought : on CocosBuilder, did you properly set your sprite scale on multiply by resolution scale ? The problem may be that it loads the right sprite, but the scale is wrong. You can also manually check the sprite scale at runtime to make sure of this.
the problem is that about the latest release cocos2d-x and cocosbuilder are not using the same resource directories.
I had to manually setup the cocosbuilder CCBReader file path. Now it is working.
François Dupayrat wrote:
Seems I won’t be able to help you much more, since I use cocos2d-x 2.0.4 and CocosBuilder 2.1.
>
Just a last thought : on CocosBuilder, did you properly set your sprite scale on multiply by resolution scale ? The problem may be that it loads the right sprite, but the scale is wrong. You can also manually check the sprite scale at runtime to make sure of this.