本文整理汇总了C++中CDevice::setDeviceSupportOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ CDevice::setDeviceSupportOrientation方法的具体用法?C++ CDevice::setDeviceSupportOrientation怎么用?C++ CDevice::setDeviceSupportOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDevice
的用法示例。
在下文中一共展示了CDevice::setDeviceSupportOrientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
CDevice *pDevice = CDevice::sharedDevice();
pDevice->setDeviceSupportOrientation(LandscapeLeft|LandscapeRight);
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
CCEGLView *pOpenGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pOpenGLView);
CApplication *pApp = CApplication::sharedApplication();
const char *lpcszResourcePath = pApp->getResourcePath();
// adapter any size
CCSize deviceScreenSize = pDirector->getWinSize();
float fHeight = deviceScreenSize.height;
float fRatio = deviceScreenSize.width / fHeight;
if( !pDevice->isPad() ) //640
{
fHeight = 640.0f;
pDevice->setCodeSizeRatio(1.0f);
std::vector<std::string> searchPaths;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
char szSearchPath[1024];
sprintf(szSearchPath,"%s%s", lpcszResourcePath, "[email protected]/");
searchPaths.push_back(szSearchPath);
sprintf(szSearchPath,"%s060/%s", lpcszResourcePath, "[email protected]/");
searchPaths.push_back(szSearchPath);
searchPaths.push_back(lpcszResourcePath);
searchPaths.push_back("[email protected]/");
searchPaths.push_back("");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
char szSearchPath[1024];
sprintf(szSearchPath,"%s%s", lpcszResourcePath, "[email protected]/");
searchPaths.push_back(szSearchPath);
sprintf(szSearchPath,"%s060/%s", lpcszResourcePath, "[email protected]/");
searchPaths.push_back(szSearchPath);
searchPaths.push_back(lpcszResourcePath);
searchPaths.push_back("[email protected]/");
searchPaths.push_back("");
#endif
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
}
else //768
{
fHeight = 768.0f;
pDevice->setCodeSizeRatio(1.2f);
std::vector<std::string> searchPaths;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
char szSearchPath[1024];
sprintf(szSearchPath,"%s%s", pApp->getResourcePath(), "[email protected]/");
searchPaths.push_back(szSearchPath);
sprintf(szSearchPath,"%s060/%s", pApp->getResourcePath(), "[email protected]/");
searchPaths.push_back(szSearchPath);
searchPaths.push_back(lpcszResourcePath);
searchPaths.push_back("[email protected]/");
searchPaths.push_back("");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
char szSearchPath[1024];
sprintf(szSearchPath,"%s%s", pApp->getResourcePath(), "[email protected]/");
searchPaths.push_back(szSearchPath);
sprintf(szSearchPath,"%s060/%s", pApp->getResourcePath(), "[email protected]/");
searchPaths.push_back(szSearchPath);
searchPaths.push_back(lpcszResourcePath);
searchPaths.push_back("[email protected]/");
searchPaths.push_back("");
#endif
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
}
//
CCLOG("search path begin");
for(std::vector<std::string>::const_iterator it = CCFileUtils::sharedFileUtils()->getSearchPaths().begin();
it != CCFileUtils::sharedFileUtils()->getSearchPaths().end(); it++)
{
CCLOG("%s", (*it).c_str() );
}
CCLOG("search path end");
//
pOpenGLView->setDesignResolutionSize((fHeight * fRatio), fHeight, kResolutionShowAll);
//
// turn on display FPS
pDirector->setDisplayStats(false);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
//ptola::CDevice *pDevice = ptola::CDevice::sharedDevice();
//CCSize s = pDevice->getScreenSize();
// register lua engine
//.........这里部分代码省略.........