mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into developBug
This commit is contained in:
commit
e2325924e4
3
AUTHORS
3
AUTHORS
|
@ -730,6 +730,9 @@ Developers:
|
|||
|
||||
pandamicro
|
||||
Exposed SAXParser to JS, it is used for parsing XML in JS.
|
||||
|
||||
hanjukim
|
||||
Fixed a bug that color and opacity settings were not applied when invoking Label::alignText.
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
|
|
@ -152,7 +152,7 @@ bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String)
|
|||
tempDef.width = tempRect.size.width + _letterPadding;
|
||||
tempDef.height = tempRect.size.height + _letterPadding;
|
||||
tempDef.offsetX = tempRect.origin.x + offsetAdjust;
|
||||
tempDef.offsetY = tempRect.origin.y - offsetAdjust;
|
||||
tempDef.offsetY = _commonLineHeight + tempRect.origin.y - offsetAdjust;
|
||||
}
|
||||
fontDefs[utf16String[i]] = tempDef;
|
||||
}
|
||||
|
|
|
@ -335,7 +335,14 @@ bool LabelTextFormatter::createStringSprites(Label *theLabel)
|
|||
// If the last character processed has an xAdvance which is less that the width of the characters image, then we need
|
||||
// to adjust the width of the string to take this into account, or the character will overlap the end of the bounding
|
||||
// box
|
||||
tmpSize.width = longestLine - charAdvance + lastCharWidth;
|
||||
if(charAdvance < lastCharWidth)
|
||||
{
|
||||
tmpSize.width = longestLine - charAdvance + lastCharWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpSize.width = longestLine;
|
||||
}
|
||||
|
||||
tmpSize.height = totalHeight;
|
||||
theLabel->setContentSize(CC_SIZE_PIXELS_TO_POINTS(tmpSize));
|
||||
|
|
|
@ -144,10 +144,10 @@ Node* SceneReader::createObject(const rapidjson::Value &dict, cocos2d::Node* par
|
|||
{
|
||||
gb->addComponent(com);
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(com);
|
||||
}
|
||||
else
|
||||
{
|
||||
com = nullptr;
|
||||
}
|
||||
}
|
||||
if(_fnSelector != nullptr)
|
||||
{
|
||||
|
|
|
@ -178,7 +178,6 @@ void TriggerObj::serialize(const rapidjson::Value &val)
|
|||
CCASSERT(con != nullptr, "");
|
||||
con->serialize(subDict);
|
||||
con->init();
|
||||
con->autorelease();
|
||||
_cons.pushBack(con);
|
||||
}
|
||||
|
||||
|
@ -199,7 +198,6 @@ void TriggerObj::serialize(const rapidjson::Value &val)
|
|||
}
|
||||
act->serialize(subDict);
|
||||
act->init();
|
||||
act->autorelease();
|
||||
_acts.pushBack(act);
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 37451f4ec2e2d01da9286ae97952582b81d02be8
|
||||
Subproject commit c8375f61ccc86b108dc3e57f2a593e30296daf7a
|
|
@ -419,7 +419,11 @@ Atlas3::Atlas3()
|
|||
label2->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label2->setColor( Color3B::RED );
|
||||
addChild(label2, 0, kTagBitmapAtlas2);
|
||||
label2->runAction( repeat->clone() );
|
||||
auto tint = Sequence::create(TintTo::create(1, 255, 0, 0),
|
||||
TintTo::create(1, 0, 255, 0),
|
||||
TintTo::create(1, 0, 0, 255),
|
||||
NULL);
|
||||
label2->runAction( RepeatForever::create(tint) );
|
||||
|
||||
auto label3 = LabelBMFont::create("Test", "fonts/bitmapFontTest2.fnt");
|
||||
// testing anchors
|
||||
|
|
|
@ -68,6 +68,7 @@ static std::function<Layer*()> createFunctions[] =
|
|||
CL(LabelTTFDistanceField),
|
||||
CL(LabelTTFDistanceFieldEffect),
|
||||
CL(LabelCharMapTest),
|
||||
CL(LabelCharMapColorTest),
|
||||
CL(LabelCrashTest),
|
||||
CL(LabelTTFOldNew)
|
||||
};
|
||||
|
@ -165,17 +166,17 @@ LabelTTFAlignmentNew::LabelTTFAlignmentNew()
|
|||
|
||||
auto ttf0 = Label::createWithTTF(config,"Alignment 0\nnew line",TextHAlignment::LEFT);
|
||||
ttf0->setPosition(Point(s.width/2,(s.height/6)*2 - 30));
|
||||
ttf0->setAnchorPoint(Point(0.5f,0.5f));
|
||||
ttf0->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
this->addChild(ttf0);
|
||||
|
||||
auto ttf1 = Label::createWithTTF(config,"Alignment 1\nnew line",TextHAlignment::CENTER);
|
||||
ttf1->setPosition(Point(s.width/2,(s.height/6)*3 - 30));
|
||||
ttf1->setAnchorPoint(Point(0.5f,0.5f));
|
||||
ttf1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
this->addChild(ttf1);
|
||||
|
||||
auto ttf2 = Label::createWithTTF(config,"Alignment 2\nnew line",TextHAlignment::RIGHT);
|
||||
ttf2->setPosition(Point(s.width/2,(s.height/6)*4 - 30));
|
||||
ttf2->setAnchorPoint(Point(0.5f,0.5f));
|
||||
ttf2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
this->addChild(ttf2);
|
||||
}
|
||||
|
||||
|
@ -207,10 +208,14 @@ LabelFNTColorAndOpacity::LabelFNTColorAndOpacity()
|
|||
label1->runAction(repeat);
|
||||
|
||||
auto label2 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Test");
|
||||
label2->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label2->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
label2->setColor( Color3B::RED );
|
||||
addChild(label2, 0, kTagBitmapAtlas2);
|
||||
label2->runAction( repeat->clone() );
|
||||
auto tint = Sequence::create(TintTo::create(1, 255, 0, 0),
|
||||
TintTo::create(1, 0, 255, 0),
|
||||
TintTo::create(1, 0, 0, 255),
|
||||
NULL);
|
||||
label2->runAction( RepeatForever::create(tint) );
|
||||
|
||||
auto label3 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Test");
|
||||
label3->setAnchorPoint( Point(1,1) );
|
||||
|
@ -260,7 +265,7 @@ LabelFNTSpriteActions::LabelFNTSpriteActions()
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
label->setPosition( Point(s.width/2, s.height/2) );
|
||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
|
||||
|
||||
auto BChar = (Sprite*) label->getLetter(0);
|
||||
|
@ -294,6 +299,7 @@ LabelFNTSpriteActions::LabelFNTSpriteActions()
|
|||
auto label2 = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "00.0");
|
||||
addChild(label2, 0, kTagBitmapAtlas2);
|
||||
label2->setPosition( Point(s.width/2.0f, 80) );
|
||||
label2->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
|
||||
auto lastChar = (Sprite*) label2->getLetter(3);
|
||||
lastChar->runAction( rot_4ever->clone() );
|
||||
|
@ -349,7 +355,7 @@ LabelFNTPadding::LabelFNTPadding()
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
label->setPosition( Point(s.width/2, s.height/2) );
|
||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
}
|
||||
|
||||
std::string LabelFNTPadding::title() const
|
||||
|
@ -370,17 +376,17 @@ LabelFNTOffset::LabelFNTOffset()
|
|||
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "FaFeFiFoFu");
|
||||
addChild(label);
|
||||
label->setPosition( Point(s.width/2, s.height/2+50) );
|
||||
label->setAnchorPoint( Point(0.5f, 0.5f) ) ;
|
||||
label->setAnchorPoint( Point::ANCHOR_MIDDLE ) ;
|
||||
|
||||
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "fafefifofu");
|
||||
addChild(label);
|
||||
label->setPosition( Point(s.width/2, s.height/2) );
|
||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
|
||||
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "aeiou");
|
||||
addChild(label);
|
||||
label->setPosition( Point(s.width/2, s.height/2-50) );
|
||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
}
|
||||
|
||||
std::string LabelFNTOffset::title() const
|
||||
|
@ -402,18 +408,18 @@ LabelFNTColor::LabelFNTColor()
|
|||
label->setColor( Color3B::BLUE );
|
||||
addChild(label);
|
||||
label->setPosition( Point(s.width/2, s.height/4) );
|
||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
|
||||
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "Red");
|
||||
addChild(label);
|
||||
label->setPosition( Point(s.width/2, 2*s.height/4) );
|
||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
label->setColor( Color3B::RED );
|
||||
|
||||
label = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "Green");
|
||||
addChild(label);
|
||||
label->setPosition( Point(s.width/2, 3*s.height/4) );
|
||||
label->setAnchorPoint( Point(0.5f, 0.5f) );
|
||||
label->setAnchorPoint( Point::ANCHOR_MIDDLE );
|
||||
label->setColor( Color3B::GREEN );
|
||||
label->setString("Green");
|
||||
}
|
||||
|
@ -442,7 +448,7 @@ LabelFNTHundredLabels::LabelFNTHundredLabels()
|
|||
|
||||
auto p = Point( CCRANDOM_0_1() * s.width, CCRANDOM_0_1() * s.height);
|
||||
label->setPosition( p );
|
||||
label->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,7 +477,7 @@ LabelFNTMultiLine::LabelFNTMultiLine()
|
|||
|
||||
// Center
|
||||
auto label2 = Label::createWithBMFont( "fonts/bitmapFontTest3.fnt", "Multi line\nCenter");
|
||||
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label2, 0, kTagBitmapAtlas2);
|
||||
|
||||
s= label2->getContentSize();
|
||||
|
@ -503,20 +509,24 @@ std::string LabelFNTMultiLine::subtitle() const
|
|||
LabelFNTandTTFEmpty::LabelFNTandTTFEmpty()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
float delta = s.height/4;
|
||||
|
||||
// LabelBMFont
|
||||
auto label1 = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "", TextHAlignment::CENTER, s.width);
|
||||
addChild(label1, 0, kTagBitmapAtlas1);
|
||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label1->setPosition(Point(s.width/2, delta));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label1->setPosition(Point(s.width/2, s.height - 100));
|
||||
|
||||
// LabelTTF
|
||||
TTFConfig ttfConfig("fonts/arial.ttf",48);
|
||||
auto label2 = Label::createWithTTF(ttfConfig,"", TextHAlignment::CENTER,s.width);
|
||||
addChild(label2, 0, kTagBitmapAtlas2);
|
||||
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label2->setPosition(Point(s.width/2, delta * 2));
|
||||
label2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label2->setPosition(Point(s.width/2, s.height / 2));
|
||||
|
||||
auto label3 = Label::createWithCharMap("fonts/tuffy_bold_italic-charmap.png", 48, 64, ' ');
|
||||
label3->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label3, 0, kTagBitmapAtlas3);
|
||||
label3->setPosition(Point(s.width/2, 100));
|
||||
|
||||
schedule(schedule_selector(LabelFNTandTTFEmpty::updateStrings), 1.0f);
|
||||
|
||||
|
@ -527,11 +537,13 @@ void LabelFNTandTTFEmpty::updateStrings(float dt)
|
|||
{
|
||||
auto label1 = static_cast<Label*>( getChildByTag(kTagBitmapAtlas1) );
|
||||
auto label2 = static_cast<Label*>( getChildByTag(kTagBitmapAtlas2) );
|
||||
auto label3 = static_cast<Label*>( getChildByTag(kTagBitmapAtlas3) );
|
||||
|
||||
if( ! setEmpty )
|
||||
{
|
||||
label1->setString("not empty");
|
||||
label2->setString("not empty");
|
||||
label3->setString("hi");
|
||||
|
||||
setEmpty = true;
|
||||
}
|
||||
|
@ -539,6 +551,7 @@ void LabelFNTandTTFEmpty::updateStrings(float dt)
|
|||
{
|
||||
label1->setString("");
|
||||
label2->setString("");
|
||||
label3->setString("");
|
||||
|
||||
setEmpty = false;
|
||||
}
|
||||
|
@ -551,7 +564,7 @@ std::string LabelFNTandTTFEmpty::title() const
|
|||
|
||||
std::string LabelFNTandTTFEmpty::subtitle() const
|
||||
{
|
||||
return "2 empty labels: new Label + .FNT and new Label + .TTF";
|
||||
return "3 empty labels: new Label + FNT/TTF/CharMap";
|
||||
}
|
||||
|
||||
LabelFNTRetina::LabelFNTRetina()
|
||||
|
@ -560,7 +573,7 @@ LabelFNTRetina::LabelFNTRetina()
|
|||
|
||||
// LabelBMFont
|
||||
auto label1 = Label::createWithBMFont("fonts/konqa32.fnt", "TESTING RETINA DISPLAY");
|
||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label1);
|
||||
label1->setPosition(Point(s.width/2, s.height/2));
|
||||
}
|
||||
|
@ -584,7 +597,7 @@ LabelFNTGlyphDesigner::LabelFNTGlyphDesigner()
|
|||
|
||||
// LabelBMFont
|
||||
auto label1 = Label::createWithBMFont("fonts/futura-48.fnt", "Testing Glyph Designer");
|
||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label1);
|
||||
label1->setPosition(Point(s.width/2, s.height/2));
|
||||
}
|
||||
|
@ -606,7 +619,7 @@ LabelTTFUnicodeChinese::LabelTTFUnicodeChinese()
|
|||
// like "Error 3 error C2146: syntax error : missing ')' before identifier 'label'";
|
||||
TTFConfig ttfConfig("fonts/wt021.ttf",55,GlyphCollection::CUSTOM, "美好的一天啊");
|
||||
auto label = Label::createWithTTF(ttfConfig,"美好的一天啊", TextHAlignment::CENTER, size.width);
|
||||
label->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label->setPosition(Point(size.width / 2, size.height /2));
|
||||
this->addChild(label);
|
||||
}
|
||||
|
@ -625,7 +638,7 @@ LabelFNTUnicodeChinese::LabelFNTUnicodeChinese()
|
|||
{
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
auto label = Label::createWithBMFont("fonts/bitmapFontChinese.fnt", "中国");
|
||||
label->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label->setPosition(Point(size.width / 2, size.height /2));
|
||||
this->addChild(label);
|
||||
}
|
||||
|
@ -674,7 +687,7 @@ LabelFNTMultiLineAlignment::LabelFNTMultiLineAlignment()
|
|||
|
||||
// create and initialize a Label
|
||||
this->_labelShouldRetain = Label::createWithBMFont("fonts/markerFelt.fnt", LongSentencesExample, TextHAlignment::CENTER, size.width/1.5);
|
||||
this->_labelShouldRetain->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
this->_labelShouldRetain->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
this->_labelShouldRetain->retain();
|
||||
|
||||
this->_arrowsBarShouldRetain = Sprite::create("Images/arrowsBar.png");
|
||||
|
@ -858,22 +871,22 @@ LabelFNTUNICODELanguages::LabelFNTUNICODELanguages()
|
|||
|
||||
auto label1 = Label::createWithBMFont("fonts/arial-unicode-26.fnt", spanish, TextHAlignment::CENTER, 200);
|
||||
addChild(label1);
|
||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label1->setPosition(Point(s.width/2, s.height/5*3));
|
||||
|
||||
auto label2 = Label::createWithBMFont("fonts/arial-unicode-26.fnt", chinese);
|
||||
addChild(label2);
|
||||
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label2->setPosition(Point(s.width/2, s.height/5*2.5));
|
||||
|
||||
auto label3 = Label::createWithBMFont("fonts/arial-26-en-ru.fnt", russian);
|
||||
addChild(label3);
|
||||
label3->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label3->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label3->setPosition(Point(s.width/2, s.height/5*2));
|
||||
|
||||
auto label4 = Label::createWithBMFont("fonts/arial-unicode-26.fnt", japanese);
|
||||
addChild(label4);
|
||||
label4->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label4->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label4->setPosition(Point(s.width/2, s.height/5*1.5));
|
||||
}
|
||||
|
||||
|
@ -896,7 +909,7 @@ LabelFNTBounds::LabelFNTBounds()
|
|||
|
||||
// LabelBMFont
|
||||
label1 = Label::createWithBMFont("fonts/boundsTestFont.fnt", "Testing Glyph Designer", TextHAlignment::CENTER, s.width);
|
||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label1);
|
||||
label1->setPosition(Point(s.width/2, s.height/2));
|
||||
}
|
||||
|
@ -973,21 +986,21 @@ LabelTTFColor::LabelTTFColor()
|
|||
auto label1 = Label::createWithTTF(ttfConfig,"Green", TextHAlignment::CENTER, size.width);
|
||||
label1->setPosition( Point(size.width/2, size.height/5 * 1.5) );
|
||||
label1->setColor( Color3B::GREEN );
|
||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label1);
|
||||
|
||||
// Red
|
||||
auto label2 = Label::createWithTTF(ttfConfig,"Red", TextHAlignment::CENTER, size.width);
|
||||
label2->setPosition( Point(size.width/2, size.height/5 * 2.0) );
|
||||
label2->setColor( Color3B::RED );
|
||||
label2->setAnchorPoint(Point(0.5, 0.5));
|
||||
label2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label2);
|
||||
|
||||
// Blue
|
||||
auto label3 = Label::createWithTTF(ttfConfig,"Blue", TextHAlignment::CENTER, size.width);
|
||||
label3->setPosition( Point(size.width/2, size.height/5 * 2.5) );
|
||||
label3->setColor( Color3B::BLUE );
|
||||
label3->setAnchorPoint(Point(0.5, 0.5));
|
||||
label3->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label3);
|
||||
}
|
||||
|
||||
|
@ -1007,7 +1020,7 @@ LabelTTFDynamicAlignment::LabelTTFDynamicAlignment()
|
|||
TTFConfig ttfConfig("fonts/arial.ttf", 45);
|
||||
_label = Label::createWithTTF(ttfConfig,LongSentencesExample, TextHAlignment::CENTER, size.width);
|
||||
_label->setPosition( Point(size.width/2, size.height/2) );
|
||||
_label->setAnchorPoint(Point(0.5, 0.5));
|
||||
_label->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
|
||||
auto menu = Menu::create(
|
||||
MenuItemFont::create("Left", CC_CALLBACK_1(LabelTTFDynamicAlignment::setAlignmentLeft, this)),
|
||||
|
@ -1079,13 +1092,13 @@ LabelTTFUnicodeNew::LabelTTFUnicodeNew()
|
|||
// Spanish
|
||||
auto label1 = Label::createWithTTF(ttfConfig,"Buen día, ¿cómo te llamas?", TextHAlignment::CENTER, size.width);
|
||||
label1->setPosition( Point(size.width/2, vSize - (vStep * 4.5)) );
|
||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label1);
|
||||
|
||||
// German
|
||||
auto label2 = Label::createWithTTF(ttfConfig,"In welcher Straße haben Sie gelebt?", TextHAlignment::CENTER,size.width);
|
||||
label2->setPosition( Point(size.width/2, vSize - (vStep * 5.5)) );
|
||||
label2->setAnchorPoint(Point(0.5, 0.5));
|
||||
label2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label2);
|
||||
|
||||
// chinese
|
||||
|
@ -1094,7 +1107,7 @@ LabelTTFUnicodeNew::LabelTTFUnicodeNew()
|
|||
ttfConfig.customGlyphs = chinese.c_str();
|
||||
auto label3 = Label::createWithTTF(ttfConfig,chinese, TextHAlignment::CENTER,size.width);
|
||||
label3->setPosition( Point(size.width/2, vSize - (vStep * 6.5)) );
|
||||
label3->setAnchorPoint(Point(0.5, 0.5));
|
||||
label3->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label3);
|
||||
}
|
||||
|
||||
|
@ -1131,7 +1144,7 @@ LabelTTFFontsTestNew::LabelTTFFontsTestNew()
|
|||
label->setPosition( Point(size.width/2, ((size.height * 0.6)/arraysize(ttfpaths) * i) + (size.height/5)));
|
||||
addChild(label);
|
||||
|
||||
label->setAnchorPoint(Point(0.5, 0.5));
|
||||
label->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
} else {
|
||||
log("ERROR: Cannot load: %s", ttfpaths[i]);
|
||||
}
|
||||
|
@ -1154,7 +1167,7 @@ LabelBMFontTestNew::LabelBMFontTestNew()
|
|||
|
||||
auto label1 = Label::createWithBMFont("fonts/bitmapFontTest2.fnt", "Hello World, this is testing the new Label using fnt file", TextHAlignment::CENTER, size.width);
|
||||
label1->setPosition( Point(size.width/2, size.height/2) );
|
||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label1);
|
||||
}
|
||||
|
||||
|
@ -1174,9 +1187,9 @@ LabelTTFDistanceField::LabelTTFDistanceField()
|
|||
TTFConfig ttfConfig("fonts/arial.ttf", 80, GlyphCollection::DYNAMIC,nullptr,true);
|
||||
|
||||
auto label1 = Label::createWithTTF(ttfConfig,"Distance Field",TextHAlignment::CENTER,size.width);
|
||||
label1->setPosition( Point(size.width/2, size.height/2) );
|
||||
label1->setPosition( Point(size.width/2, size.height * 0.6f) );
|
||||
label1->setColor( Color3B::GREEN );
|
||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label1);
|
||||
|
||||
auto action = Sequence::create(
|
||||
|
@ -1187,9 +1200,9 @@ LabelTTFDistanceField::LabelTTFDistanceField()
|
|||
label1->runAction(RepeatForever::create(action));
|
||||
|
||||
auto label2 = Label::createWithTTF(ttfConfig,"Distance Field",TextHAlignment::CENTER,size.width);
|
||||
label2->setPosition( Point(size.width/2, size.height/5) );
|
||||
label2->setPosition( Point(size.width/2, size.height * 0.3f) );
|
||||
label2->setColor( Color3B::RED );
|
||||
label2->setAnchorPoint(Point(0.5, 0.5));
|
||||
label2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label2);
|
||||
|
||||
}
|
||||
|
@ -1214,23 +1227,23 @@ LabelTTFDistanceFieldEffect::LabelTTFDistanceFieldEffect()
|
|||
TTFConfig ttfConfig("fonts/arial.ttf", 80, GlyphCollection::DYNAMIC,nullptr,true);
|
||||
|
||||
auto label1 = Label::createWithTTF(ttfConfig,"Glow", TextHAlignment::CENTER, size.width);
|
||||
label1->setPosition( Point(size.width/2, size.height*0.5) );
|
||||
label1->setPosition( Point(size.width/2, size.height*0.65) );
|
||||
label1->setColor( Color3B::GREEN );
|
||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label1->setLabelEffect(LabelEffect::GLOW,Color3B::YELLOW);
|
||||
addChild(label1);
|
||||
|
||||
auto label2 = Label::createWithTTF(ttfConfig,"Outline", TextHAlignment::CENTER, size.width);
|
||||
label2->setPosition( Point(size.width/2, size.height*0.375) );
|
||||
label2->setPosition( Point(size.width/2, size.height*0.5) );
|
||||
label2->setColor( Color3B::RED );
|
||||
label2->setAnchorPoint(Point(0.5, 0.5));
|
||||
label2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label2->setLabelEffect(LabelEffect::OUTLINE,Color3B::BLUE);
|
||||
addChild(label2);
|
||||
|
||||
auto label3 = Label::createWithTTF(ttfConfig,"Shadow", TextHAlignment::CENTER, size.width);
|
||||
label3->setPosition( Point(size.width/2, size.height*0.25f) );
|
||||
label3->setPosition( Point(size.width/2, size.height*0.35f) );
|
||||
label3->setColor( Color3B::RED );
|
||||
label3->setAnchorPoint(Point(0.5, 0.5));
|
||||
label3->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label3->setLabelEffect(LabelEffect::SHADOW,Color3B::BLACK);
|
||||
addChild(label3);
|
||||
|
||||
|
@ -1257,14 +1270,9 @@ LabelCharMapTest::LabelCharMapTest()
|
|||
|
||||
auto label2 = Label::createWithCharMap("fonts/tuffy_bold_italic-charmap.plist");
|
||||
addChild(label2, 0, kTagSprite2);
|
||||
label2->setPosition( Point(10,160) );
|
||||
label2->setPosition( Point(10,200) );
|
||||
label2->setOpacity( 32 );
|
||||
|
||||
auto label3 = Label::createWithCharMap("fonts/tuffy_bold_italic-charmap.png", 48, 64, ' ');
|
||||
label3->setString("123 Test");
|
||||
addChild(label3, 0, kTagSprite3);
|
||||
label3->setPosition( Point(10,220) );
|
||||
|
||||
schedule(schedule_selector(LabelCharMapTest::step));
|
||||
}
|
||||
|
||||
|
@ -1292,6 +1300,63 @@ std::string LabelCharMapTest::subtitle() const
|
|||
return "Updating label should be fast.";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//
|
||||
// LabelCharMapColorTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
LabelCharMapColorTest::LabelCharMapColorTest()
|
||||
{
|
||||
auto label1 = Label::createWithCharMap( "fonts/tuffy_bold_italic-charmap.png", 48, 64, ' ');
|
||||
addChild(label1, 0, kTagSprite1);
|
||||
label1->setPosition( Point(10,100) );
|
||||
label1->setOpacity( 200 );
|
||||
|
||||
auto label2 = Label::createWithCharMap("fonts/tuffy_bold_italic-charmap.png", 48, 64, ' ');
|
||||
addChild(label2, 0, kTagSprite2);
|
||||
label2->setPosition( Point(10,200) );
|
||||
label2->setColor( Color3B::RED );
|
||||
|
||||
auto fade = FadeOut::create(1.0f);
|
||||
auto fade_in = fade->reverse();
|
||||
auto cb = CallFunc::create(CC_CALLBACK_0(LabelCharMapColorTest::actionFinishCallback, this));
|
||||
auto seq = Sequence::create(fade, fade_in, cb, NULL);
|
||||
auto repeat = RepeatForever::create( seq );
|
||||
label2->runAction( repeat );
|
||||
|
||||
_time = 0;
|
||||
|
||||
schedule( schedule_selector(LabelCharMapColorTest::step) ); //:@selector(step:)];
|
||||
}
|
||||
|
||||
void LabelCharMapColorTest::actionFinishCallback()
|
||||
{
|
||||
CCLOG("Action finished");
|
||||
}
|
||||
|
||||
void LabelCharMapColorTest::step(float dt)
|
||||
{
|
||||
_time += dt;
|
||||
char string[12] = {0};
|
||||
sprintf(string, "%2.2f Test", _time);
|
||||
auto label1 = (Label*)getChildByTag(kTagSprite1);
|
||||
label1->setString(string);
|
||||
|
||||
auto label2 = (Label*)getChildByTag(kTagSprite2);
|
||||
sprintf(string, "%d", (int)_time);
|
||||
label2->setString( string );
|
||||
}
|
||||
|
||||
std::string LabelCharMapColorTest::title() const
|
||||
{
|
||||
return "New Label + CharMap";
|
||||
}
|
||||
|
||||
std::string LabelCharMapColorTest::subtitle() const
|
||||
{
|
||||
return "Opacity + Color should work at the same time";
|
||||
}
|
||||
|
||||
LabelCrashTest::LabelCrashTest()
|
||||
{
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
|
@ -1300,7 +1365,7 @@ LabelCrashTest::LabelCrashTest()
|
|||
|
||||
auto label1 = Label::createWithTTF(ttfConfig,"Test崩溃123", TextHAlignment::CENTER, size.width);
|
||||
label1->setPosition( Point(size.width/2, size.height/2) );
|
||||
label1->setAnchorPoint(Point(0.5, 0.5));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
addChild(label1);
|
||||
}
|
||||
|
||||
|
@ -1321,14 +1386,14 @@ LabelTTFOldNew::LabelTTFOldNew()
|
|||
|
||||
auto label1 = LabelTTF::create("Cocos2d-x Label Test", "arial", 24);
|
||||
addChild(label1, 0, kTagBitmapAtlas1);
|
||||
label1->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label1->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label1->setPosition(Point(s.width/2, delta * 2));
|
||||
label1->setColor(Color3B::RED);
|
||||
|
||||
TTFConfig ttfConfig("fonts/arial.ttf", 48);
|
||||
auto label2 = Label::createWithTTF(ttfConfig, "Cocos2d-x Label Test");
|
||||
addChild(label2, 0, kTagBitmapAtlas2);
|
||||
label2->setAnchorPoint(Point(0.5f, 0.5f));
|
||||
label2->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
label2->setPosition(Point(s.width/2, delta * 2));
|
||||
}
|
||||
|
||||
|
|
|
@ -363,6 +363,23 @@ private:
|
|||
float _time;
|
||||
};
|
||||
|
||||
class LabelCharMapColorTest : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelCharMapColorTest);
|
||||
|
||||
LabelCharMapColorTest();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
void step(float dt);
|
||||
void actionFinishCallback();
|
||||
|
||||
private:
|
||||
float _time;
|
||||
};
|
||||
|
||||
class LabelCrashTest : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -63,7 +63,9 @@ static std::function<Layer*()> createFunctions[] =
|
|||
CL(NodeToWorld3D),
|
||||
CL(SchedulerTest1),
|
||||
CL(CameraOrbitTest),
|
||||
CL(CameraZoomTest),
|
||||
//Camera has been removed from CCNode
|
||||
//todo add new feature to support it
|
||||
//CL(CameraZoomTest),
|
||||
CL(ConvertToNode),
|
||||
CL(NodeOpaqueTest),
|
||||
CL(NodeNonOpaqueTest),
|
||||
|
|
|
@ -292,6 +292,7 @@ void NodeDeallocTest::update(float dt)
|
|||
|
||||
for( int i=0; i<quantityOfNodes; ++i) {
|
||||
nodes[i] = Node::create();
|
||||
nodes[i]->retain();
|
||||
}
|
||||
|
||||
CC_PROFILER_START(this->profilerName());
|
||||
|
|
|
@ -85,6 +85,8 @@ void TextureTest::performTestsPNG(const char* filename)
|
|||
struct timeval now;
|
||||
Texture2D *texture;
|
||||
auto cache = Director::getInstance()->getTextureCache();
|
||||
|
||||
Texture2D::PixelFormat defaultFormat = Texture2D::getDefaultAlphaPixelFormat();
|
||||
|
||||
log("RGBA 8888");
|
||||
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGBA8888);
|
||||
|
@ -125,6 +127,8 @@ void TextureTest::performTestsPNG(const char* filename)
|
|||
else
|
||||
log(" ERROR");
|
||||
cache->removeTexture(texture);
|
||||
|
||||
Texture2D::setDefaultAlphaPixelFormat(defaultFormat);
|
||||
}
|
||||
|
||||
void TextureTest::performTests()
|
||||
|
|
|
@ -160,7 +160,7 @@ void SchedulerPauseResume::onEnter()
|
|||
|
||||
schedule(schedule_selector(SchedulerPauseResume::tick1), 0.5f);
|
||||
schedule(schedule_selector(SchedulerPauseResume::tick2), 0.5f);
|
||||
schedule(schedule_selector(SchedulerPauseResume::pause), 0.5f);
|
||||
schedule(schedule_selector(SchedulerPauseResume::pause), 3.0f);
|
||||
}
|
||||
|
||||
void SchedulerPauseResume::tick1(float dt)
|
||||
|
|
|
@ -52,26 +52,6 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
return true;
|
||||
}
|
||||
|
||||
void handle_signal(int signal) {
|
||||
static int internal_state = 0;
|
||||
ScriptingCore* sc = ScriptingCore::getInstance();
|
||||
// should start everything back
|
||||
Director* director = Director::getInstance();
|
||||
if (director->getRunningScene()) {
|
||||
director->popToRootScene();
|
||||
} else {
|
||||
PoolManager::sharedPoolManager()->finalize();
|
||||
if (internal_state == 0) {
|
||||
//sc->dumpRoot(NULL, 0, NULL);
|
||||
sc->start();
|
||||
internal_state = 1;
|
||||
} else {
|
||||
sc->runScript("hello.js");
|
||||
internal_state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#ifndef _APP_DELEGATE_H_
|
||||
#define _APP_DELEGATE_H_
|
||||
|
||||
#include "CCApplication.h"
|
||||
#include "cocos2d.h"
|
||||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import requests
|
|||
import sys
|
||||
import traceback
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
#set Jenkins build description using submitDescription to mock browser behavior
|
||||
#TODO: need to set parent build description
|
||||
|
@ -58,7 +59,7 @@ def main():
|
|||
jenkins_url = os.environ['JENKINS_URL']
|
||||
job_name = os.environ['JOB_NAME'].split('/')[0]
|
||||
build_number = os.environ['BUILD_NUMBER']
|
||||
target_url = jenkins_url + 'job/' + job_name + '/' + build_number
|
||||
target_url = jenkins_url + 'job/' + job_name + '/' + build_number + '/'
|
||||
|
||||
set_description(pr_desc, target_url)
|
||||
|
||||
|
@ -142,8 +143,12 @@ def main():
|
|||
#TODO: add ios build
|
||||
#TODO: add mac build
|
||||
#TODO: add win32 build
|
||||
node_name = os.environ['NODE_NAME']
|
||||
if(branch == 'develop'):
|
||||
ret = os.system("python build/android-build.py -n -j10 all")
|
||||
if(node_name == 'android_mac') or (node_name == 'android_win7'):
|
||||
ret = os.system("python build/android-build.py -n -j10 all")
|
||||
elif(node_name == 'win32_win7'):
|
||||
ret = subprocess.call('"%VS110COMNTOOLS%..\IDE\devenv.com" "build\cocos2d-win32.vc2012.sln" /Build "Debug|Win32"', shell=True)
|
||||
elif(branch == 'master'):
|
||||
ret = os.system("samples/Cpp/TestCpp/proj.android/build_native.sh")
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames ge
|
|||
LayerGradient::[initWithColor=init],
|
||||
LayerColor::[initWithColor=init],
|
||||
GLProgram::[initWithVertexShaderByteArray=initWithString initWithVertexShaderFilename=init programLog=getProgramLog setUniformLocationWith1i=setUniformLocationI32],
|
||||
Node::[removeFromParentAndCleanup=removeFromParent removeAllChildrenWithCleanup=removeAllChildren getLocalZOrder=getZOrder],
|
||||
Node::[removeFromParentAndCleanup=removeFromParent removeAllChildrenWithCleanup=removeAllChildren getLocalZOrder=getZOrder setLocalZOrder=setZOrder],
|
||||
LabelAtlas::[create=_create],
|
||||
Sprite::[initWithFile=init],
|
||||
SpriteBatchNode::[initWithFile=init removeAllChildrenWithCleanup=removeAllChildren],
|
||||
|
|
Loading…
Reference in New Issue