本文整理汇总了C++中setDisplayStats函数的典型用法代码示例。如果您正苦于以下问题:C++ setDisplayStats函数的具体用法?C++ setDisplayStats怎么用?C++ setDisplayStats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setDisplayStats函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Rect
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if (!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
glview = GLViewImpl::createWithRect("oop4", Rect(0, 0, 600, 600));
director->setOpenGLView(glview);
#else
glview = GLViewImpl::create("oop4");
#endif
director->setOpenGLView(glview);
};
//FPS 조절 함수
director->setDisplayStats(true);
director->setAnimationInterval(1.0 / 60);
//////////원하는 크기로 화면 재설정/////////////////
Size frameSize = glview->getFrameSize();
// if the frame's height is larger than the height of medium size.
if (frameSize.height > mediumResolutionSize.height)
{
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is larger than the height of small size.
else if (frameSize.height > smallResolutionSize.height)
{
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is smaller than the height of medium size.
else
{
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
}
//////////////////화면 크기에 맞게 맵을 출력/////////////////////////////
glview->setDesignResolutionSize(375, 375, ResolutionPolicy::NO_BORDER);
register_all_packages();
// create a scene. it's an autorelease object
auto scene = GameScene::createScene();
// run
director->runWithScene(scene);
return true;
}
示例2: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::create("My Game");
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
//add search
FileUtils::getInstance()->addSearchPath("res/");
FileUtils::getInstance()->addSearchPath("res/icon/");
FileUtils::getInstance()->addSearchPath("res/scene/");
FileUtils::getInstance()->addSearchPath("res/effect");
FileUtils::getInstance()->addSearchPath("fg/");
StatusManager::getInstance()->read(); //读取status
HeroManager::getInstance()->read(); //读取herodata
SkillManager::getInstance()->read(); //读取skilldata
g_gameClientManager = new GameClientManager();
g_gameClientManager->createNewGame();
// create a scene. it's an autorelease object
//auto scene = HelloWorld::createScene();
auto scene = BattleReady_Scene::createScene();
//auto scene = Team_Scene::createScene();
//auto scene = MapMain_Scene::createScene();
// run
director->runWithScene(scene);
return true;
}
示例3: Rect
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
glview = GLViewImpl::createWithRect("SceneTransEx1", Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
glview = GLViewImpl::create("SceneTransEx1");
#endif
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
// Set the design resolution
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
Size frameSize = glview->getFrameSize();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
frameSize = Size(480, 320);
#endif
// if the frame's height is larger than the height of medium size.
if (frameSize.height > mediumResolutionSize.height)
{
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is larger than the height of small size.
else if (frameSize.height > smallResolutionSize.height)
{
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is smaller than the height of medium size.
else
{
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
}
register_all_packages();
// create a scene. it's an autorelease object
auto scene = HelloWorld::createScene();
// run
director->runWithScene(scene);
return true;
}
示例4: Rect
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || \
(CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || \
(CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
glview = GLViewImpl::createWithRect("Battle of Stars", Rect(0, 0, developmentResolutionSize.width, developmentResolutionSize.height));
// XXX: Full Screen Here!
// glview = GLViewImpl::createWithFullScreen("ball");
#else
glview = GLViewImpl::create("Battle of Stars");
#endif
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(false);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
// Set the design resolution
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
Size frameSize = glview->getFrameSize();
// if the frame's height is larger than the height of medium size.
if (frameSize.height > mediumResolutionSize.height) {
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
// if the frame's height is larger than the height of small size.
} else if (frameSize.height > smallResolutionSize.height) {
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
// if the frame's height is smaller than the height of medium size.
} else {
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
}
register_all_packages();
FileUtils::getInstance()->addSearchPath("res");
// create a scene. it's an autorelease object
//auto scene = MenuScene::createScene();
auto scene = TransitionFade::create(1.0f, BeginScene::createScene());
// run
director->runWithScene(scene);
return true;
}
示例5: Rect
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::createWithRect("SushiNeko", Rect(0, 0, 640, 960));
director->setOpenGLView(glview);
}
glview->setDesignResolutionSize(640, 960, ResolutionPolicy::FIXED_WIDTH);
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
FileUtils::getInstance()->addSearchPath("res");
std::vector<std::string> searchResolutionsOrder(1);
cocos2d::Size targetSize = glview->getFrameSize();
if (targetSize.height < 481.0f)
{
searchResolutionsOrder[0] = "resources-1x";
}
else if (targetSize.height < 1137.0f)
{
searchResolutionsOrder[0] = "resources-2x";
}
else if (targetSize.height < 2047.0f)
{
searchResolutionsOrder[0] = "resources-3x";
}
else
{
searchResolutionsOrder[0] = "resources-4x";
}
FileUtils::getInstance()->setSearchResolutionsOrder(searchResolutionsOrder);
// create a scene. it's an autorelease object
auto scene = MainScene::createScene();
// run
director->runWithScene(scene);
return true;
}
示例6: Rect
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
glview = GLViewImpl::createWithRect("Archer", Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
glview = GLViewImpl::create("Archer");
#endif
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(false);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
//获取屏幕大小;
auto screenSize = glview->getFrameSize();
//设计分辨率大小;
auto designSize = Size(1280,720);
//资源大小;
auto resourceSize = Size(1280, 720);
std::vector<std::string> searchPaths;
if (screenSize.height > 720) { //640x1136
designSize = Size(1920, 1080);
searchPaths.push_back("picture");
}
else {
searchPaths.push_back("picture");
}
director->setContentScaleFactor(resourceSize.width / designSize.width); //默认为1.0f
FileUtils::getInstance()->setSearchPaths(searchPaths);
glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER);
// create a scene. it's an autorelease object
auto scene = HelloWorld::createScene();
// run
director->runWithScene(scene);
return true;
}
示例7: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::create("Meone Game");
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
// Set the design resolution
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::SHOW_ALL);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
glview->setFrameSize(designResolutionSize.width, designResolutionSize.height);
#endif
/*
Size frameSize = glview->getFrameSize();
// if the frame's height is larger than the height of medium size.
if (frameSize.height > mediumResolutionSize.height)
{
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is larger than the height of small size.
else if (frameSize.height > smallResolutionSize.height)
{
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is smaller than the height of medium size.
else
{
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
}
*/
register_all_packages();
this->setResourceSearchResolution();
// create a scene. it's an autorelease object
auto scene = LoadingScene::createScene();
// run
director->runWithScene(scene);
return true;
}
示例8: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::create("DemoTest");
//glview->setFrameSize(1334, 750);
//glview->setContentScaleFactor(2);
//glview->setDesignResolutionSize(960, 512, ResolutionPolicy::FIXED_WIDTH);
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(false);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
// Set the design resolution
glview->setDesignResolutionSize(1334,750, ResolutionPolicy::NO_BORDER);
//glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
//director->setContentScaleFactor(3.2);
/* Size frameSize = glview->getFrameSize();
// if the frame's height is larger than the height of medium size.
if (frameSize.height > mediumResolutionSize.height)
{
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is larger than the height of small size.
else if (frameSize.height > smallResolutionSize.height)
{
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is smaller than the height of medium size.
else
{
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
}*/
register_all_packages();
// create a scene. it's an autorelease object Æðʼ³¡¾°
auto scene = MenuScene::createScene();
// run
director->runWithScene(scene);
return true;
}
示例9: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// director and window initialisation
auto director = Director::getInstance();
auto eglView = EGLView::getInstance();
director->setOpenGLView(eglView);
director->setDisplayStats(true);
director->setAnimationInterval(1.0 / 60);
auto scene = HelloWorld::createScene();
// run
director->runWithScene(scene);
return true;
}
示例10: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
sdkbox::PluginGoogleAnalytics::init();
sdkbox::PluginGoogleAnalytics::startSession();
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::create("My Game");
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
// Set the design resolution
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
Size frameSize = glview->getFrameSize();
// if the frame's height is larger than the height of medium size.
if (frameSize.height > mediumResolutionSize.height)
{
director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is larger than the height of small size.
else if (frameSize.height > smallResolutionSize.height)
{
director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
}
// if the frame's height is smaller than the height of medium size.
else
{
director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
}
register_all_packages();
// create a scene. it's an autorelease object
auto scene = HelloWorld::createScene();
// run
director->runWithScene(scene);
return true;
}
示例11: LOGD
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
Size winSize = director->getWinSize();
if(!glview) {
//glview = GLView::createWithRect("My Game", Rect(0, 0, winSize.width, winSize.height), 1);
glview = GLView::create("My Game");
//glview->setFrameSize(540, 960);
director->setOpenGLView(glview);
}
//director->setContentScaleFactor(MIN(birdResource.size.height/designResolutionSize.height, birdResource.size.width/designResolutionSize.width));
//director->setContentScaleFactor(birdResource.size.height/designResolutionSize.height);
//director->setContentScaleFactor(birdResource.size.width/designResolutionSize.width);
//glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::SHOW_ALL);
//director->setContentScaleFactor(1.0);
float scale = director->getContentScaleFactor();
LOGD("scale is %f", scale);
this->setResourceSearchResolution();
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
//auto scene = HelloWorld::createScene();
auto scene = Scene::create();
auto layer = new GameController();
layer->autorelease();
layer->addConsoleAutoGame();
scene->addChild(layer);
//auto scene = LoadingScene::create();
// run
director->runWithScene(scene);
return true;
}
示例12: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::createWithRect("War of Planes",Rect(0,0,800,1280));//注意不要让屏幕在windows中无法显示,会出现奇葩错误,可以利用ZoomFactor调节
//glview->setFrameZoomFactor(0.65f);
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
//屏幕大小
auto screenSize = glview->getFrameSize();
//设计分辨率大小
auto designSize = Size(400, 640);
//资源大小
auto resourceSize = Size(480, 800);
std::vector<std::string> searchPaths;
if (screenSize.height > 960) { //640x1136
designSize = Size(800, 1280);
searchPaths.push_back("texture");
} else {
searchPaths.push_back("texture");
}
director->setContentScaleFactor(resourceSize.width/designSize.width);
FileUtils::getInstance()->setSearchPaths(searchPaths);
glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::FIXED_WIDTH);
// create a scene. it's an autorelease object
auto scene = LoadingLayer::scene();
// run
director->runWithScene(scene);
return true;
}
示例13: getmyStorage
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::create("HereticTrainer");
director->setOpenGLView(glview);
}
// 存放路径
std::vector<std::string> searchPaths;
// 得到外部存放音乐目录
getmyStorage(searchPaths);
// 在mac平台调试
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
searchPaths.push_back("Resources/");
searchPaths.push_back("/Users/ZHP/Animation/Lovelive/LLpractice/Play/");
printf("%s\n", searchPaths[0].c_str());
#endif
FileUtils::getInstance()->setSearchPaths(searchPaths);
initAudioEngine();
// 不显示屏幕信息
director->setDisplayStats(false);
// 分辨率匹配
glview->setDesignResolutionSize(1080, 720, ResolutionPolicy::SHOW_ALL);
// 设置FPS,每秒刷新60次
director->setAnimationInterval(1.0 / 60);
if (!UserDefault::getInstance()->getBoolForKey("ok")) {
UserDefault::getInstance()->setBoolForKey("ok", true);
UserDefault::getInstance()->setDoubleForKey("rate", 1.0);
UserDefault::getInstance()->setDoubleForKey("baddis", 144);
UserDefault::getInstance()->setDoubleForKey("gooddis", 80);
UserDefault::getInstance()->setDoubleForKey("greatdis", 50);
UserDefault::getInstance()->setDoubleForKey("perfectdis", 20);
UserDefault::getInstance()->setDoubleForKey("offsetdis", 0);
UserDefault::getInstance()->setDoubleForKey("touchdis", 142);
UserDefault::getInstance()->setDoubleForKey("touchwidth", 80);
UserDefault::getInstance()->setDoubleForKey("touchheight", 140);
UserDefault::getInstance()->flush();
}
auto scene = SelectSong::createScene();
director->runWithScene(scene);
return true;
}
示例14: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if (!glview) {
return false;
}
glview->setFrameSize(600, 450);
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
auto scene = Scene::create();
scene->setContentSize(Director::getInstance()->getVisibleSize());
// run
director->runWithScene(scene);
Rect rect(0, 0, 4096, 2048);
Sprite* grid = Sprite::create("grid1_16x16_new_aaa.png");
grid->setTextureRect(rect);
Texture2D::TexParams params = {
GL_LINEAR,
GL_LINEAR,
GL_REPEAT,
GL_REPEAT
};
grid->getTexture()->setTexParameters(params);
grid->setAnchorPoint(Vec2::ZERO);
grid->setPosition(Vec2::ZERO);
scene->addChild(grid);
director->runWithScene(scene);
return true;
}
示例15: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::create("Starcraft");
director->setOpenGLView(glview);
}
glview->setDesignResolutionSize(DISPLAY_WIDTH, DISPLAY_HEIGHT, ResolutionPolicy::SHOW_ALL);
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
register_all_packages();
///////////////////////////로그인 서버로 접속
if(PLAY_ALONE) {
glview->setDesignResolutionSize(1280, 720, ResolutionPolicy::SHOW_ALL);
auto scene = GameWorld::createScene();
// run
director->runWithScene(scene);
}else{
GameClient::GetInstance().Initialize();
auto networkBGLayer = NetworkLayer::create();
networkBGLayer->retain();
GameClient::GetInstance().currentScene = NO_SCENE_NOW;
Scene* scene = HelloWorld::createScene();
scene->addChild(networkBGLayer, 0, TAG_NETWORK_LAYER);
Director::getInstance()->runWithScene(scene);
networkBGLayer->handler->frontSendFirstConnectReq();
}
return true;
}