Game Development Reference
In-Depth Information
Time for action - adding retina support
This time we'll work with the class AppDelegate.cpp :
1. Go to AppDelegate.cpp (you'll find it in the Classes folder). Inside the ap-
plicationDidFinishLaunching method, and below the director-
>setAnimationInterval(1.0 / 60) line, add the following lines:
auto screenSize = glview->getFrameSize();
auto designSize = Size(768, 1024);
glview->setDesignResolutionSize(designSize.width,
designSize.height, ResolutionPolicy::EXACT_FIT);
std::vector<std::string> searchPaths;
if (screenSize.width > 768) {
searchPaths.push_back("hd");
director->setContentScaleFactor(2);
} else {
searchPaths.push_back("sd");
director->setContentScaleFactor(1);
}
auto fileUtils = FileUtils::getInstance();
fileUtils->setSearchPaths(searchPaths);
2. Save the file.
Search WWH ::




Custom Search