I’ve seen this completed in Geometry Sprint (which can be programmed with Cocos2d-x c++) and I need to know :
A) Scale each aspect based on the window measurement
B) Preserve side ratio when resizing window
C) Refresh measurement and place of every aspect when window measurement is altered
D) Enable switching to full display screen in-game
I’m very new to cocos2dx and c++, so I figured I might cease right here to try to determine this all out.
Thanks to anybody who helps!!
In AppDelegate.cpp, discover the applicationDidFinishLaunching() perform:
bool AppDelegate::applicationDidFinishLaunching() {
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::createWithRect("MyGame", cocos2d::Rect(0,0,960,640)); // Preliminary window measurement
director->setOpenGLView(glview);
}
// Set the Design Decision Dimension
// That is the display screen measurement you used to design your recreation.
// Instance: You designed your recreation on a 960x640 display screen
director->getOpenGLView()->setDesignResolutionSize(960, 640, ResolutionPolicy::SHOW_ALL);
// ... (different settings)
return true;
}
Within the instance above, I used ResolutionPolicy::SHOW_ALL. You’ll be able to strive different insurance policies to see which one most accurately fits your recreation.
Thanks, Patterson. That clarification helps make clear how the design decision works. Simply to verify, if I need UI parts to reposition accurately when resizing the window, ought to I manually replace their positions within the onResize occasion, or is there a built-in method to deal with that?

