From 32f23ebdba70f0e8d6cd5d31d04a60011071da84 Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Mon, 16 Dec 2013 11:04:52 +0800 Subject: [PATCH] fix bad position for performance test about Label. --- .../Classes/PerformanceTest/PerformanceLabelTest.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceLabelTest.cpp b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceLabelTest.cpp index 210b5b8807..f5c91270a8 100644 --- a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceLabelTest.cpp +++ b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceLabelTest.cpp @@ -195,7 +195,7 @@ void LabelMainScene::onIncrease(Object* sender) for( int i=0;i< kNodesIncrease;i++) { auto label = LabelTTF::create("LabelTTF", "Marker Felt", 30); - label->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height * 0.8f))); + label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50))); _labelContainer->addChild(label, 1, _quantityNodes); _quantityNodes++; @@ -205,7 +205,7 @@ void LabelMainScene::onIncrease(Object* sender) for( int i=0;i< kNodesIncrease;i++) { auto label = LabelBMFont::create("LabelBMFont", "fonts/bitmapFontTest3.fnt"); - label->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height * 0.8f))); + label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50))); _labelContainer->addChild(label, 1, _quantityNodes); _quantityNodes++; @@ -215,7 +215,7 @@ void LabelMainScene::onIncrease(Object* sender) for( int i=0;i< kNodesIncrease;i++) { auto label = Label::createWithTTF("Label", "fonts/arial.ttf", 60, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr,true); - label->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height * 0.8f))); + label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50))); _labelContainer->addChild(label, 1, _quantityNodes); _quantityNodes++; @@ -225,7 +225,7 @@ void LabelMainScene::onIncrease(Object* sender) for( int i=0;i< kNodesIncrease;i++) { auto label = LabelBMFont::create(LongSentencesExample, "fonts/bitmapFontTest3.fnt"); - label->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height * 0.8f))); + label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50))); _labelContainer->addChild(label, 1, _quantityNodes); _quantityNodes++; @@ -235,7 +235,7 @@ void LabelMainScene::onIncrease(Object* sender) for( int i=0;i< kNodesIncrease;i++) { auto label = Label::createWithTTF(LongSentencesExample, "fonts/arial.ttf", 60, size.width, TextHAlignment::CENTER, GlyphCollection::DYNAMIC,nullptr); - label->setPosition(Point((rand() % (int)size.width), (rand() % (int)size.height * 0.8f))); + label->setPosition(Point((rand() % 50), rand()%((int)size.height/3))); _labelContainer->addChild(label, 1, _quantityNodes); _quantityNodes++; @@ -417,7 +417,7 @@ void LabelMainScene::finishAutoTest() } } - log("Sprite performance test is finish "); + log("Label performance test is finish "); } void LabelMainScene::onAutoTest(Object* sender)