2.0.4 Multi-resolution support suggestion


#1

some suggestion about Multi-resolution in cocos2d-x 2.0.4.
1.Use CCFileUtils::sharedFileUtils()->setResourceDirectory(path_string) is not a good way, it conflict with xcode’s multiple target resolution.
As you know, a file adding to xcode only by “Recursively create groups for any added folders” way can set its target belongs to.
But if you use so setResourceDirectory, you must add your picture by “Create Folder References for any added folders” way to add it to a blue color group.
But If your product has many versions, mutiple target is the best way to manage them.

2.About kResolutionNoBorder.It’s the best way to make a game.It will be without distortion ,and If you make the coordinates base on ‘visible rectangle’ all the game elements will show in screen, so perfect.
But there is a much easier way to do this by adding your background image not in Opengl Viewport. In ios for example, you can setDesignResolutionSize to (480, 320) and use kResolutionShowAll policy.But you don’t need add background picture in a scene.And in every scene’s
void onEnter()
{
UIImageView image = initWithImage:];
image.frame = .bounds;
CCEGLView
openglView = [[CCDirector sharedDirector] openglView];
[[RootViewController shared].view insertSubview:image belowSubview:openglView];
}
the code in onEnter() should be platform-dependent, and I only show how to do it in ios,so i write it in object-c.
Maybe cocos2d-x should offer a function to do this, add a background picture below game’s Opengl Viewport,it is a full screen background.And you can change it any time.Hope adding this to make kResolutionNoBorder easier.


#2

Thank you for your suggestion.

  1. CCFileUtils::setResourceDirectory() is used for all platforms. “Recursively create groups for any added folders” only exists on iOS. Add resources to a blue color group can not bring you much inconvenience.
  2. CCDirector::setDesignResolutionSize() not only zooms in/out background image, it zooms in/out all images.

#3

thinks to your shared!
when i use setDesignResolutionSize() to fit Multi-resolution. it broke a problem was black side.
so ,i would like to only zooms in/out background image besides.
void onEnter() {
UIImageView image = initWithImage:];
image.frame = .bounds;
CCEGLView
openglView = [[CCDirector sharedDirector] openglView];
[[RootViewController shared].view insertSubview:image belowSubview:openglView];
}
may be a good idea!