cocos2d-x icon indicating copy to clipboard operation
cocos2d-x copied to clipboard

Fix Label::draw

Open realnick opened this issue 5 years ago • 3 comments

Fix Label::draw skips drawing when batchNodes are more than one and have empty quads

realnick avatar May 28 '20 08:05 realnick

image use continues will cause diifent font type show

nameLogen avatar Nov 19 '20 06:11 nameLogen

It seems font type is same but missing outline. Do you have any test code to reproduce your issue?

realnick avatar Nov 21 '20 22:11 realnick

@nameLogen, I could not reproduce your issue in my test code(see #20616), but I found similar case at BMFONT or CHARMAP. If you are using BMFONT or CHARMAP, could you try following patch as well?

--git a/cocos2d/cocos/2d/CCLabel.cpp b/cocos2d/cocos/2d/CCLabel.cpp
index 79a31ce..ad9b2f1 100644
--- a/cocos2d/cocos/2d/CCLabel.cpp
+++ b/cocos2d/cocos/2d/CCLabel.cpp
@@ -1749,7 +1749,7 @@ void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
             // ETC1 ALPHA supports for BMFONT & CHARMAP
             auto textureAtlas = _batchNodes.at(0)->getTextureAtlas();
             if(!textureAtlas->getTotalQuads())
-                return;
+                continue;

             auto texture = textureAtlas->getTexture();
             auto& pipelineQuad = _quadCommand.getPipelineDescriptor();

realnick avatar Nov 24 '20 03:11 realnick