本文整理汇总了C++中CCDirector::enableRetinaDisplay方法的典型用法代码示例。如果您正苦于以下问题:C++ CCDirector::enableRetinaDisplay方法的具体用法?C++ CCDirector::enableRetinaDisplay怎么用?C++ CCDirector::enableRetinaDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCDirector
的用法示例。
在下文中一共展示了CCDirector::enableRetinaDisplay方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
TargetPlatform target = getTargetPlatform();//获取当前设备类型
if (target == kTargetIpad){//如果是Ipad
if (pDirector->enableRetinaDisplay(true)){ //如果开启高清视网膜
}else {
}
}
else if (target == kTargetIphone) {//如果是iphone
if (pDirector->enableRetinaDisplay(true))
{
}
else
{
}
}
else if (target == kTargetAndroid)//如果是android
{
}
else if (target == kTargetWindows)//如果是Windows
{
}
else if (target == kTargetMacOS)//如果是MacOS
{
}
// turn on display FPS
pDirector->setDisplayStats(false);
// set FPS. the default value is 1.0/60 if you don't call thisdf
pDirector->setAnimationInterval(1.0 / 60);
// game init
CCScheduler * scheduler = CCDirector::sharedDirector()->getScheduler();
scheduler->scheduleSelector(schedule_selector(AppDelegate::AppUpdate), this, 1.0f/60, false);
if( GameControl::RunGameControl() )
{
NetMessageManager::GetMessageManager();
}
if( SceneManage::GetSceneManageHendle() )
{
SceneManage::GetSceneManageHendle()->RunScece( SCENE_LOGIN, false );
}
return true;
}
示例2: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
CCSize frameSize = pEGLView->getFrameSize();
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
TargetPlatform target = getTargetPlatform();
if(target == kTargetIpad)
{
// ipad
if(pDirector->enableRetinaDisplay(true))
{
// ipad hd
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd");
}
else
{
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad");
}
}
else if(target == kTargetIphone)
{
// iphone
if(pDirector->enableRetinaDisplay(true))
{
if(pDirector->getWinSize().width > 480)
{
// iphone hd 4'
CCFileUtils::sharedFileUtils()->setResourceDirectory("iphone");
}
else
{
// iphone hd 3'
CCFileUtils::sharedFileUtils()->setResourceDirectory("iphone");
}
}
}
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
CCScene *pScene = HelloWorld::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例3: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
// pDirector->enableRetinaDisplay(true);
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320,kResolutionShowAll);
TargetPlatform target = getTargetPlatform();
if (target == kTargetIpad)
{
// ipad
if (pDirector->enableRetinaDisplay(true))
{
// ipad hd
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd");
}
else
{
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad");
}
}
else if (target == kTargetIphone)
{
// iphone
if (pDirector->enableRetinaDisplay(true))
{
// iphone hd
CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
}
}
// turn off 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);
// create a scene. it's an autorelease object
CCScene *pScene = MainMenu::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例4: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
TargetPlatform target = getTargetPlatform();
if (target == kTargetIpad)
{
// ipad
if (pDirector->enableRetinaDisplay(true))
{
// ipad hd
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd");
}
else
{
CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad");
}
}
else if (target == kTargetIphone)
{
// iphone
if (pDirector->enableRetinaDisplay(true))
{
// iphone hd
CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
}
}
//script config
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
LuaHelper::s_executeFile( "resources_define.lua");
LuaHelper::s_executeFile( "ui_texts_chs.lua");
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
SceneManager::startLogoScene();
return true;
}
示例5: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
AppSettings::sharedAppSettings()->initWithPlistFile("config.plist");
char buffer[50];
for(int i = 1; i <= 4; i++)
{
sprintf(buffer, "brickbig%d.wav", i);
std::string absPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(buffer);
CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect(absPath.c_str());
}
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
pDirector->enableRetinaDisplay(true);
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
float fRate = 1.0f / AppSettings::sharedAppSettings()->getFloat("defaultSpriteFrameRate");
pDirector->setAnimationInterval(fRate);
// create a scene. it's an autorelease object
CCScene *pScene = GameView::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例6: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
pDirector->enableRetinaDisplay(true);
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// test_1
// CCScene *pScene = game_bj::scene();
// pDirector->runWithScene(pScene);
// test_2
// layer_main *layer_main = new layer_main();
// CCScene *pScene = layer_main->scene();
// pDirector->replaceScene(pScene);
CCScene *pScene = cj_1::scene();
pDirector->runWithScene(pScene);
return true;
}
示例7: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
pDirector->enableRetinaDisplay(true);
// sets landscape mode
// pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
// turn on display FPS
pDirector->setDisplayFPS(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
CCScene *pScene = MainScene::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例8:
//初始化引擎
void Ag2dEngine::start()
{
CCDirector* director = CCDirector::sharedDirector();
//初始化场景导演
director->setOpenGLView(&CCEGLView::sharedOpenGLView());
director->enableRetinaDisplay(CONF_ENABLE_RETINA);
director->setDisplayFPS(CONF_SHOW_FPS);
director->setAnimationInterval(CONF_FPS_VAL);
//启动
playScene( reg_scene );
}
示例9: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
pDirector->enableRetinaDisplay(false);
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
pDirector->setDisplayFPS(false);
pDirector->setAnimationInterval(1.0 / 60);
pDirector->setDepthTest(false);
CCScene *pScene = GameScene::node();
CCDirector::sharedDirector()->runWithScene(pScene);
return true;
}
示例10: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
pDirector->enableRetinaDisplay(true);
CCTexture2D::PVRImagesHavePremultipliedAlpha(true);
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 30);
// register lua engine --- by GW
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
// create a scene. it's an autorelease object
//CCScene *pScene = HelloWorld::scene();
CCScene *pScene = GamePlayScene::scene();
//CCScene *pScene = TestScene::scene();
// run
pDirector->runWithScene(pScene);
/*
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
pEngine->executeString(pstrFileContent->getCString());
}
#else
std::string path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());
#endif
*/
return true;
}
示例11: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
pDirector->enableRetinaDisplay(true);
//TargetPlatform target = getTargetPlatform();
// if (target == kTargetIpad)
// {
// // ipad
//
// // try to enable retina on device
// if (true == pDirector->enableRetinaDisplay(true))
// {
// // iphone hd
// CCFileUtils::sharedFileUtils()->setResourceDirectory("spriteshd");
// CCFileUtils::sharedFileUtils()->setResourceDirectory("backgroundhd");
// }
// else
// {
// CCFileUtils::sharedFileUtils()->setResourceDirectory("sprites");
// CCFileUtils::sharedFileUtils()->setResourceDirectory("background");
// }
// }
// else if (target == kTargetIphone)
// {
// // iphone
//
// // try to enable retina on device
// if (true == pDirector->enableRetinaDisplay(true))
// {
// // iphone hd
// CCFileUtils::sharedFileUtils()->setResourceDirectory("spriteshd");
// CCFileUtils::sharedFileUtils()->setResourceDirectory("backgroundhd");
// }
// else
// {
// CCFileUtils::sharedFileUtils()->setResourceDirectory("sprites");
// CCFileUtils::sharedFileUtils()->setResourceDirectory("background");
//
// }
// }
// else
// {
// // android, windows, blackberry, linux or mac
// // use 960*640 resources as design resolution size
// CCFileUtils::sharedFileUtils()->setResourceDirectory("spriteshd");
// CCFileUtils::sharedFileUtils()->setResourceDirectory("backgroundhd");
// //CCEGLView::sharedOpenGLView()->setDesignResolutionSize(800, 480, kResolutionNoBorder);
// }
//CCFileUtils::sharedFileUtils()->setResourceDirectory("spriteshd");
//CCFileUtils::sharedFileUtils()->setResourceDirectory("backgroundhd");
// 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);
// create a scene. it's an autorelease object
CCScene *pScene = Menu::scene();
// run
pDirector->runWithScene(pScene);
return true;
}