本文整理汇总了C++中CCDirector::setDisplayFPS方法的典型用法代码示例。如果您正苦于以下问题:C++ CCDirector::setDisplayFPS方法的具体用法?C++ CCDirector::setDisplayFPS怎么用?C++ CCDirector::setDisplayFPS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCDirector
的用法示例。
在下文中一共展示了CCDirector::setDisplayFPS方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
// 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 = HelloWorld::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例2: 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 opengl landscape mode
// tests set device orientation in RootViewController.mm
// 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);
CCScene * pScene = CCScene::node();
CCLayer * pLayer = new TestController();
pLayer->autorelease();
pScene->addChild(pLayer);
//pDirector->runWithScene(HelloWorld::scene());
pDirector->runWithScene(pScene);
return true;
}
示例3: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
// turn on display FPS
pDirector->setDisplayFPS(false);
//pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
// 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;
}
示例4: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// init the window
if (!(m_pMainWnd = new CCXEGLView(this)) ||
! m_pMainWnd->Create(&TRectangle(0,0,GetScreenWidth(),GetScreenHeight())))
{
CCX_SAFE_DELETE(m_pMainWnd);
return false;
}
// init director
CCDirector * pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(m_pMainWnd);
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
// pDirector->setDeviceOrientation(kCCDeviceOrientationPortrait);
pDirector->setDisplayFPS(true);
// set the resource path
CCFileUtils::setResourcePath("/NEWPLUS/TDA_DATA/Data/[!output PROJECT_NAME]/");
[! if CCX_USE_UI_RESOURCE]
// cocos2d find image in ResourceEntry first, in ResourcePath second.
// set the ResourceEntry,
CCFileUtils::setResourceEntry(&[!output PROJECT_NAME]ResourceEntry);
// set the Images ResInfo (name and ResID)
CCFileUtils::setResourceInfo(ResInfo, sizeof(ResInfo) / sizeof(T_ResourceInfo));
[! endif]
CCScene * pScene = HelloWorld::scene();
pDirector->runWithScene(pScene);
return true;
}
示例5: 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);
// run
// this is crashing for me every time if I just pass a plain cstr
#ifdef TESTBUILD
// TestScene *ts = new TestScene();
// ts->init();
// CCDirector::sharedDirector()->runWithScene(ts);
ScriptingCore::getInstance().runScript("JS/main-testbuild.js");
#else
ScriptingCore::getInstance().runScript("JS/main.js");
// TestScene *ts = new TestScene();
// ts->init();
// CCDirector::sharedDirector()->runWithScene(ts);
#endif
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->setDisplayFPS(true);
// pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// register lua engine
CCScriptEngineProtocol* pEngine = CCLuaEngine::engine();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
unsigned long size;
#ifdef KILLA
char *pFileContent = (char*)CCFileUtils::getFileData("boot.kia", "r", &size);
#else
char *pFileContent = (char*)CCFileUtils::getFileData("boot.lua", "r", &size);
#endif
if (pFileContent)
{
// copy the file contents and add '\0' at the end, or the lua parser can not parse it
char *pCodes = new char[size + 1];
pCodes[size] = '\0';
memcpy(pCodes, pFileContent, size);
delete[] pFileContent;
pEngine->executeString(pCodes);
delete []pCodes;
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
#ifdef KILLA
string path = CCFileUtils::fullPathFromRelativePath("boot.kia");
#else
string path = CCFileUtils::fullPathFromRelativePath("boot.lua");
#endif
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());
#endif
return true;
}
示例7:
//初始化引擎
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 );
}
示例8: 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->setDisplayFPS(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
[! if CC_USE_LUA]
// init lua engine
CCLuaEngine* pEngine = CCLuaEngine::sharedEngine();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
unsigned long size;
char *pFileContent = (char*)CCFileUtils::getFileData("hello.lua", "r", &size);
if (pFileContent)
{
// copy the file contents and add '\0' at the end, or the lua parser can not parse it
char *pCodes = new char[size + 1];
pCodes[size] = '\0';
memcpy(pCodes, pFileContent, size);
delete[] pFileContent;
pEngine->executeString(pCodes);
delete []pCodes;
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
string path = CCFileUtils::fullPathFromRelativePath("hello.lua");
pEngine->executeScriptFile(path.c_str());
#endif
[! else]
// create a scene. it's an autorelease object
CCScene *pScene = HelloWorld::scene();
// run
pDirector->runWithScene(pScene);
[! endif]
return true;
}
示例9: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
pDirector->setDisplayFPS(true);
pDirector->setAnimationInterval(1.0 / 60);
//初始化动画管理器
sAnimationMgr->initAnimationMap();
//创建游戏主界面
CCScene *pScene = GameScene::playNewGame();
//让director运行场景
pDirector->runWithScene(pScene);
return true;
}
示例10: 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;
}
示例11: RunApplication
void GSceneSelector::RunApplication()
{
GnSrand( time( 0 ) );
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
pDirector->setDisplayFPS(true);
pDirector->setAnimationInterval(1.0 / 60);
CreatePlayingData();
GScene* gameScene = CreateStartScene();
if( gameScene )
pDirector->runWithScene( gameScene );
SetCurrentScene( gameScene );
CCDirector::sharedDirector()->setDisplayFPS(false);
}
示例12: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// init the window
#if defined(CCX_PLATFORM_UPHONE)
if (!(m_pMainWnd = new CCXEGLView(this)) ||
! m_pMainWnd->Create(&TRectangle(0,0,GetScreenWidth(),GetScreenHeight())))
#elif defined(CCX_PLATFORM_WIN32)
if (! (m_pMainWnd = new CCXEGLView()) ||
! m_pMainWnd->Create(L"HelloWorld", 320, 480))
#elif defined(CCX_PLATFORM_IPHONE)
if (! (m_pMainWnd = new CCXEGLView() ) )
#else
#error
#endif
{
delete m_pMainWnd;
return false;
}
// init director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(m_pMainWnd);
// sets landscape mode
pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
// turn on display FPS
pDirector->setDisplayFPS(true);
// create a scene. it's an autorelease object
CCScene *pScene = HelloWorld::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例13: 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->setDisplayFPS(true);
// pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// register lua engine
m_pLuaEngine = new LuaEngine;
CCScriptEngineManager::sharedScriptEngineManager()->setScriptEngine(m_pLuaEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
unsigned long size;
char *pFileContent = (char*)CCFileUtils::getFileData("hello.lua", "r", &size);
if (pFileContent)
{
// copy the file contents and add '\0' at the end, or the lua parser can not parse it
char *pCodes = new char[size + 1];
pCodes[size] = '\0';
memcpy(pCodes, pFileContent, size);
delete[] pFileContent;
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeString(pCodes);
delete []pCodes;
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// CCLuaScriptModule::sharedLuaScriptModule()->executeScriptFile("./../../HelloLua/Resource/hello.lua");
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeScriptFile("./../../HelloLua/Resource/hello.lua");
/*
* Another way to run lua script.
* Load the file into memory and run it.
*
unsigned long size;
char *pFileContent = (char*)CCFileUtils::getFileData("./../../HelloLua/Resource/hello.lua", "r", &size);
if (pFileContent)
{
// copy the file contents and add '\0' at the end, or the lua parser can not parse it
char *pTmp = new char[size + 1];
pTmp[size] = '\0';
memcpy(pTmp, pFileContent, size);
delete[] pFileContent;
string code(pTmp);
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->excuteScriptFile(code);
delete []pTmp;
}
*/
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
string path = CCFileUtils::fullPathFromRelativePath("hello.lua");
printf("%s", path.c_str());
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeScriptFile(path.c_str());
#endif
return true;
}