Vertical object alignment when using setDesignResolutionSize

Hello guys,
I am working with the current 3.0-alpha0 version of cocos2d-x, but I have a problem that I think is common to v. 2.x too.

In the app delegate I am calling:

eglView->setDesignResolutionSize(GameUtils::getWidth(), GameUtils::getHeight(), ResolutionPolicy::FIXED_WIDTH); director->setContentScaleFactor(director->getWinSize().width/GameUtils::getWidth());

using the native iPhone 5 resolution size (640x1136). I am using the FIXED_WIDTH policy since I do not mind screen height for the main game view. By the way, in the home screen I’d like to center a popup vertically, and insert a scroll view too.

What happens is this:
# On the iPhone 5 screen the scroll view is correctly placed (top aligned to the window) and the popup shows up in the center of the screen
# On the iPhone 4 screen the scroll view is correctly placed but the popup will show up a bit higher than the center of the screen
# On the iPad 1/2 screen the scroll view is too high and will be truncated in it’s higher point, and the popup shows the same problems as for the iPhone 4 screen
# On the retina iPad the scroll view is so much high that it’s invisible and I have to scroll a lot to the bottom to start seeing its content; also the popup is almost at the top of the screen

The scroll has been created like this:
ScrollView *scroll = ScrollView::create(Director::getInstance()->getWinSize()); scroll->setDirection(ScrollView::Direction::VERTICAL);
and added as a child directly to the home scene.

The popup has been added to the scene this way:

@ setAnchorPoint(Point(0.5, 0.5));
setPosition(GameUtils::getWidth()/2, GameUtils::getHeight()/2);@

(I was using setPosition() with the getWinSize() value, but the misplacement of the popup was much more visible).

How can I overcome these two problems?


Schermata 19.nov.2013 15.18.44 simulatore iOS .png (143.5 KB)


Schermata 19.nov.2013 15.15.09 simulatore iOS .png (136.5 KB)


Schermata 19.nov.2013 15.14.57 simulatore iOS .png (119.9 KB)


Schermata 19.nov.2013 15.14.25 simulatore iOS .png (76.0 KB)

Hi @marzapower, I am facing the same issue. Did you fix it? If yes would you kind sharing the solution. :slight_smile: