Hi!
I have a problem with assets using Cocos Studio. I created a simple Resolution-Test project for different resolutions.
Now what I do:
-
I put in the MainScene the test.png from the ipadhd folder since my design resolution is
2048x1536
-
I save everything and publish to Xcode
-
Cocos Studio publishes only the assets that are used so I copy the android/androidhd/androiduhd/ipad folders from
cocosstudio
to theResource
directory -
I change the code in
AppDelegate.cpp
to:auto director = Director::getInstance();
auto glview = director->getOpenGLView();glview->setDesignResolutionSize(2048, 1536, ResolutionPolicy::NO_BORDER);
FileUtils::getInstance()->addSearchPath(“res”);
std::vectorstd::string searchResolutionsOrder(1);
cocos2d::Size targetSize = glview->getFrameSize();
if (targetSize.width < 1279.0f)
{
searchResolutionsOrder[0] = “ipad”;
}
else if (targetSize.width < 1919.0f)
{
searchResolutionsOrder[0] = “android”;
}
else if (targetSize.width < 2047.0f)
{
searchResolutionsOrder[0] = “androidhd”;
}
else if (targetSize.width < 2559.0f)
{
searchResolutionsOrder[0] = “ipadhd”;
}
else
{
searchResolutionsOrder[0] = “androiduhd”;
}FileUtils::getInstance()->setSearchResolutionsOrder(searchResolutionsOrder);
This code works but it does NOT take the correct assets. Basically the problem is that the asset is ALWAYS taken from the ipadhd
directory. If I create a scene in Cocos Studio and take the asset from androidhd
then it takes ALWAYS from the androidhd directory. When I remove the lets call it “base” directory (so in my example the ipadhd
folder) then there is a black screen, all other directories are being ignored.
Why is it so and how can I force the device to take the correct asset? I mean… there must be a way because if not then there is no point of putting assets for different resolutions in the app
The above code works (it cuts the top and bottom edge) but I think it takes the 2048x1536 assets and scales them instead of taking the special prepared assets (lets say for example 1280x800)
Thats why even a simple 2d game runs at 30fps instead of solid 60fps.