mirror of https://github.com/axmolengine/axmol.git
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
df4cb47ab3
|
@ -1,8 +1,10 @@
|
|||
cocos2d-x-3.0final ?.? ?
|
||||
[All]
|
||||
[FIX] CocoStudio: TestColliderDetector in ArmatureTest can't work.
|
||||
[FIX] Crash if file doesn't exist when using FileUtils::getStringFromFile.
|
||||
[FIX] If setting a shorter string than before while using LabelAtlas, the effect will be wrong.
|
||||
[NEW] Label: Uses a struct of TTF configuration for Label::createWithTTF to reduce parameters and make this interface more easily to use.
|
||||
[FIX] Label: Label::createWithTTF crashes when using unknown characters.
|
||||
[NEW] Console: added the 'textures', 'fileutils dump' and 'config' commands
|
||||
[NEW] DrawNode supports to draw triangle, quad bezier, cubic bezier.
|
||||
[NEW] Renderer: Added BatchCommand. This command is not "batchable" with other commands, but improves performance in about 10%
|
||||
|
|
|
@ -100,6 +100,7 @@ bool FontAtlas::getLetterDefinitionForChar(unsigned short letteCharUTF16, FontL
|
|||
}
|
||||
else
|
||||
{
|
||||
outDefinition.validDefinition = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,20 +63,24 @@ bool LabelTextFormatter::multilineText(LabelTextFormatProtocol *theLabel)
|
|||
{
|
||||
LetterInfo* info = &leterInfo->at(j+skip);
|
||||
|
||||
unsigned int justSkipped = 0;
|
||||
unsigned int justSkipped = 0;
|
||||
|
||||
while (info->def.validDefinition == false)
|
||||
{
|
||||
justSkipped++;
|
||||
info = &leterInfo->at( j+skip+justSkipped );
|
||||
tIndex = j+skip+justSkipped;
|
||||
if(tIndex < strLen)
|
||||
info = &leterInfo->at( tIndex );
|
||||
else
|
||||
break;
|
||||
}
|
||||
skip += justSkipped;
|
||||
tIndex = j + skip;
|
||||
|
||||
if (i >= stringLength)
|
||||
if (tIndex >= stringLength)
|
||||
break;
|
||||
|
||||
unsigned short character = strWhole[i];
|
||||
unsigned short character = strWhole[tIndex];
|
||||
|
||||
if (!isStartOfWord)
|
||||
{
|
||||
|
@ -241,8 +245,6 @@ bool LabelTextFormatter::alignText(LabelTextFormatProtocol *theLabel)
|
|||
continue;
|
||||
}
|
||||
int index = static_cast<int>(i + lineLength - 1 + lineNumber);
|
||||
if(currentChar == 0)
|
||||
index -= 1;
|
||||
if (index < 0) continue;
|
||||
|
||||
LetterInfo* info = &leterInfo->at( index );
|
||||
|
|
|
@ -115,7 +115,7 @@ void DisplayFactory::updateDisplay(Bone *bone, float dt, bool dirty)
|
|||
anchorPoint = PointApplyTransform(anchorPoint, displayTransform);
|
||||
displayTransform.mat[12] = anchorPoint.x;
|
||||
displayTransform.mat[13] = anchorPoint.y;
|
||||
kmMat4 t = TransformConcat(displayTransform, bone->getArmature()->getNodeToParentTransform());
|
||||
kmMat4 t = TransformConcat( bone->getArmature()->getNodeToParentTransform(),displayTransform);
|
||||
detector->updateTransform(t);
|
||||
}
|
||||
while (0);
|
||||
|
|
|
@ -197,7 +197,7 @@ void Skin::updateTransform()
|
|||
|
||||
kmMat4 Skin::getNodeToWorldTransform() const
|
||||
{
|
||||
return TransformConcat(_transform, _bone->getArmature()->getNodeToWorldTransform());
|
||||
return TransformConcat( _bone->getArmature()->getNodeToWorldTransform(), _transform);
|
||||
}
|
||||
|
||||
kmMat4 Skin::getNodeToWorldTransformAR() const
|
||||
|
|
|
@ -1067,8 +1067,22 @@ void TestColliderDetector::update(float delta)
|
|||
}
|
||||
void TestColliderDetector::draw()
|
||||
{
|
||||
armature2->drawContour();
|
||||
_customCommand.init(0, _vertexZ);
|
||||
_customCommand.func = CC_CALLBACK_0(TestColliderDetector::onDraw, this);
|
||||
Director::getInstance()->getRenderer()->addCommand(&_customCommand);
|
||||
}
|
||||
|
||||
void TestColliderDetector::onDraw()
|
||||
{
|
||||
kmMat4 oldMat;
|
||||
kmGLGetMatrix(KM_GL_MODELVIEW, &oldMat);
|
||||
kmGLLoadMatrix(&_modelViewTransform);
|
||||
|
||||
armature2->drawContour();
|
||||
|
||||
kmGLLoadMatrix(&oldMat);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -271,6 +271,7 @@ public:
|
|||
virtual std::string title() const override;
|
||||
virtual void update(float delta);
|
||||
virtual void draw();
|
||||
void onDraw();
|
||||
|
||||
void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
|
||||
|
||||
|
@ -278,6 +279,7 @@ public:
|
|||
cocostudio::Armature *armature;
|
||||
cocostudio::Armature *armature2;
|
||||
|
||||
CustomCommand _customCommand; //new render needed this for drawing primitives
|
||||
cocos2d::Sprite *bullet;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -66,7 +66,8 @@ static std::function<Layer*()> createFunctions[] =
|
|||
CL(LabelTTFUnicodeNew),
|
||||
CL(LabelBMFontTestNew),
|
||||
CL(LabelTTFDistanceField),
|
||||
CL(LabelTTFDistanceFieldEffect)
|
||||
CL(LabelTTFDistanceFieldEffect),
|
||||
CL(LabelCrashTest)
|
||||
};
|
||||
|
||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||
|
@ -1242,3 +1243,25 @@ std::string LabelTTFDistanceFieldEffect::subtitle() const
|
|||
{
|
||||
return "Testing effect base on DistanceField";
|
||||
}
|
||||
|
||||
LabelCrashTest::LabelCrashTest()
|
||||
{
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
|
||||
TTFConfig ttfConfig("fonts/arial.ttf", 80, GlyphCollection::DYNAMIC,nullptr,true);
|
||||
|
||||
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));
|
||||
addChild(label1);
|
||||
}
|
||||
|
||||
std::string LabelCrashTest::title() const
|
||||
{
|
||||
return "New Label Crash Test";
|
||||
}
|
||||
|
||||
std::string LabelCrashTest::subtitle() const
|
||||
{
|
||||
return "Not crash and show [Test123] when using unknown character.";
|
||||
}
|
||||
|
|
|
@ -347,6 +347,16 @@ public:
|
|||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
class LabelCrashTest : public AtlasDemoNew
|
||||
{
|
||||
public:
|
||||
CREATE_FUNC(LabelCrashTest);
|
||||
|
||||
LabelCrashTest();
|
||||
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
// we don't support linebreak mode
|
||||
|
||||
|
|
Loading…
Reference in New Issue