Problem with scaling depends on screen resolution?

Problem with scaling depends on screen resolution?
0.0 0


Hi , I’m having problem working with multi screen solution. I’ve done the search around but still couldn’t find the solution since those answer were oudated / using deprecated method or unclear to me. After 3 hours of searching and tried many different advices, I still couldn’t get it done and I got confused so I have to create this topic. Your attention and help is very much appreciated.

My situation: I’m working with designResolutionSize = cocos2d::Size(1280, 720);. It works fine on my PC monitor (with screen solution 1600x900) but when I install my app on a set-top box and run it on a 30 inch or 40 inch TV. My sprites don’t scale up to fit the TV screen, they looks too tiny.

My question How should I make my App scale up/down depends on the device resolution to fit the screen?

My AppDelegate.cpp:

static cocos2d::Size designResolutionSize = cocos2d::Size(1280, 720);

bool AppDelegate::applicationDidFinishLaunching(){
	// Get the Director instance
	auto mDirector = Director::getInstance();
	// Get the GL View Container
	auto mGLView = mDirector->getOpenGLView();
		//Set up View Container if there's no available one
	if (!mGLView)
		mGLView = GLViewImpl::create("NGTV Launcher");
		/*mGLView->setFrameSize(1280, 720);*/
		mGLView->setFrameSize(1600, 900);
		/*mGLView->setFrameSize(1920, 1080);*/

	mGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::EXACT_FIT);
	// Innitialize a Scene with createScene()
	auto mScene = HelloWorld::createScene();
	// Run the scenee

	return true;


I think you missing “setContentScaleFactor”, try:

mDirector->setContentScaleFactor(designResolutionSize.height / mGLView->getFrameSize().height);