Game Development Reference
In-Depth Information
Game settings
This is a portrait-orientation-only game, with no screen rotation allowed, and universal ap-
plication. The game is designed for the regular iPhone (320 x 480) and its resolution size is
set to kResolutionShowAll . This will show borders around the main screen in devices
that do not match the 1.5 screen ratio of the iPhone.
//in AppDelegate.cpp
auto screenSize = glview->getFrameSize();
auto designSize = Size(320, 480);
glview->setDesignResolutionSize(designSize.width,
designSize.height, ResolutionPolicy::SHOW_ALL);
std::vector<std::string> searchPaths;
if (screenSize.width > 640) {
searchPaths.push_back("ipadhd");
director->setContentScaleFactor(1280/designSize.width);
} else if (screenSize.width > 320) {
searchPaths.push_back("ipad");
director->setContentScaleFactor(640/designSize.width);
} else {
searchPaths.push_back("iphone");
director->setContentScaleFactor(320/designSize.width);
}
auto fileUtils = FileUtils::getInstance();
fileUtils->setSearchPaths(searchPaths);
Note that I use the iPhone's dimensions to identify larger screens. So the iPad and the
iPhone retina are considered to be two times 320 x 480 and the retina iPad is considered to
be four times 320 x 480.
Search WWH ::




Custom Search