Skip to content

Commit 4ab1378

Browse files
committed
Fixup merge issue cause compile errors
1 parent 7e09a73 commit 4ab1378

File tree

5 files changed

+29
-28
lines changed

5 files changed

+29
-28
lines changed

core/2d/DrawNode.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,17 +1179,16 @@ void DrawNode::_drawSegment(const Vec2& from,
11791179
}
11801180
}
11811181
// Internal function _drawLine => thickness is always 1 (fastes way to draw a line)
1182-
void DrawNode::_drawLine(const Vec2& from, const Vec2& to, const Color4B& color)
1182+
void DrawNode::_drawLine(const Vec2& from, const Vec2& to, const Color& color)
11831183
{
11841184
Vec2 vertices[2] = {from, to};
11851185
applyTransform(vertices, vertices, 2);
11861186

1187-
1188-
auto line = expandBufferAndGetPointer(_lines, 2);
1187+
auto line = expandBufferAndGetPointer(_lines, 2);
11891188
_linesDirty = true;
11901189

1191-
line[0] = {vertices[0], color, Vec2::ZERO};
1192-
line[1] = {vertices[1], color, Vec2::ZERO};
1190+
line[0] = {vertices[0], Vec2::ZERO, color};
1191+
line[1] = {vertices[1], Vec2::ZERO, color};
11931192
}
11941193

11951194
void DrawNode::_drawDot(const Vec2& pos, float radius, const Color& color)

core/2d/DrawNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ class AX_DLL DrawNode : public Node
634634
bool isconvex = true);
635635

636636
// Internal function _drawLine
637-
void _drawLine(const Vec2& from, const Vec2& to, const Color4B& color);
637+
void _drawLine(const Vec2& from, const Vec2& to, const Color& color);
638638

639639
// Internal function _drawSegment
640640
void _drawSegment(const Vec2& origin,

core/2d/Label.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,8 +1724,8 @@ void Label::updateContent()
17241724

17251725
if (_lineDrawNode)
17261726
{
1727-
Color4B lineColor = Color4B(_displayedColor);
1728-
if (_textColor != Color4B::WHITE && _textColor != lineColor)
1727+
Color32 lineColor = Color32(_displayedColor);
1728+
if (_textColor != Color32::WHITE && _textColor != lineColor)
17291729
lineColor = _textColor;
17301730

17311731
_lineDrawNode->clear();
@@ -1746,10 +1746,12 @@ void Label::updateContent()
17461746
Color(lineColor), thickness);
17471747
}
17481748

1749-
// Github issue #15214. Uses _displayedColor instead of _textColor for the underline.
1750-
// This is to have the same behavior of SystemFonts.
1751-
_underlineNode->drawLine(Vec2(_linesOffsetX[i], y), Vec2(_linesWidth[i] + _linesOffsetX[i], y),
1752-
Color(_displayedColor), charheight / 6);
1749+
if (_underlineEnabled)
1750+
{
1751+
float y = (_numberOfLines - i - 1) * charheight;
1752+
_lineDrawNode->drawLine(Vec2(_linesOffsetX[i], y), Vec2(_linesWidth[i] + _linesOffsetX[i], y),
1753+
Color(lineColor), thickness);
1754+
}
17531755
}
17541756
}
17551757
else if (_textSprite) // ...and is the logic for System fonts

tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,9 +1929,9 @@ void DrawNodeLineDrawTest::update(float dt)
19291929
float x = radius * cosf(rads) + center.x;
19301930
float y = radius * sinf(rads) + center.y;
19311931

1932-
drawNode->drawLine(center - Vec2(20, 40), Vec2(x, y)- Vec2(20, 40), Color4F::RED, sliderValue[sliderType::Thickness]);
1933-
drawNode->drawLine(center + Vec2(120, 20), Vec2(x, y) + Vec2(120,20), Color4F::BLUE, sliderValue[sliderType::Thickness]);
1934-
drawNode->drawLine(center - Vec2(130, 110),Vec2(x,y) - Vec2(130,110), Color4F::GREEN, sliderValue[sliderType::Thickness]);
1932+
drawNode->drawLine(center - Vec2(20, 40), Vec2(x, y)- Vec2(20, 40), Color::RED, sliderValue[sliderType::Thickness]);
1933+
drawNode->drawLine(center + Vec2(120, 20), Vec2(x, y) + Vec2(120,20), Color::BLUE, sliderValue[sliderType::Thickness]);
1934+
drawNode->drawLine(center - Vec2(130, 110),Vec2(x,y) - Vec2(130,110), Color::GREEN, sliderValue[sliderType::Thickness]);
19351935
}
19361936
}
19371937

tests/cpp-tests/Source/LabelTest/LabelTestNew.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3279,8 +3279,8 @@ LabelUnderlineStrikethroughMultiline::LabelUnderlineStrikethroughMultiline()
32793279
// Glow SDF (GPU)
32803280
auto label1 = Label::createWithTTF(ttfConf, "Glow1", TextHAlignment::CENTER, s.width);
32813281
label1->setPosition(Vec2(s.width / 2, s.height * 0.7));
3282-
label1->setTextColor(Color4B::GREEN);
3283-
label1->enableGlow(Color4B::YELLOW);
3282+
label1->setTextColor(Color32::GREEN);
3283+
label1->enableGlow(Color32::YELLOW);
32843284
label1->enableUnderline();
32853285
label1->enableStrikethrough();
32863286
addChild(label1);
@@ -3289,8 +3289,8 @@ LabelUnderlineStrikethroughMultiline::LabelUnderlineStrikethroughMultiline()
32893289
ttfConf.distanceFieldEnabled = false;
32903290
auto label2 = Label::createWithTTF(ttfConf, "Glow2", TextHAlignment::CENTER, s.width);
32913291
label2->setPosition(Vec2(s.width / 2, s.height * 0.6));
3292-
label2->setTextColor(Color4B::GREEN);
3293-
label2->enableGlow(Color4B::YELLOW);
3292+
label2->setTextColor(Color32::GREEN);
3293+
label2->enableGlow(Color32::YELLOW);
32943294
label2->enableUnderline();
32953295
label2->enableStrikethrough();
32963296
addChild(label2);
@@ -3300,8 +3300,8 @@ LabelUnderlineStrikethroughMultiline::LabelUnderlineStrikethroughMultiline()
33003300
ttfConf.outlineSize = 2;
33013301
auto label3 = Label::createWithTTF(ttfConf, "Outline1", TextHAlignment::CENTER, s.width);
33023302
label3->setPosition(Vec2(s.width / 2, s.height * 0.48));
3303-
label3->setTextColor(Color4B::RED);
3304-
label3->enableOutline(Color4B::BLUE);
3303+
label3->setTextColor(Color32::RED);
3304+
label3->enableOutline(Color32::BLUE);
33053305
label3->enableUnderline();
33063306
label3->enableStrikethrough();
33073307
addChild(label3);
@@ -3311,8 +3311,8 @@ LabelUnderlineStrikethroughMultiline::LabelUnderlineStrikethroughMultiline()
33113311
ttfConf.outlineSize = 2;
33123312
auto label4 = Label::createWithTTF(ttfConf, "Outline2", TextHAlignment::CENTER, s.width);
33133313
label4->setPosition(Vec2(s.width / 2, s.height * 0.36));
3314-
label4->setTextColor(Color4B::RED);
3315-
label4->enableOutline(Color4B::BLUE, 2);
3314+
label4->setTextColor(Color32::RED);
3315+
label4->enableOutline(Color32::BLUE, 2);
33163316
label4->enableUnderline();
33173317
label4->enableStrikethrough();
33183318
addChild(label4);
@@ -3328,29 +3328,29 @@ LabelUnderlineStrikethroughMultiline::LabelUnderlineStrikethroughMultiline()
33283328
Label* label[count];
33293329

33303330
label[0] = Label::createWithSystemFont("SystemFont TextVAlignment::TOP\nusing setTextColor(255, 0, 255, 100)", font, 14, Vec2::ZERO, TextHAlignment::LEFT, TextVAlignment::TOP);
3331-
label[0]->setTextColor(Color4B(255, 0, 255, 100));
3332-
label[0]->enableGlow(Color4B::BLUE);
3331+
label[0]->setTextColor(Color32(255, 0, 255, 100));
3332+
label[0]->enableGlow(Color32::BLUE);
33333333

33343334
label[1] = Label::createWithSystemFont("SystemFont TextVAlignment::CENTER\nusing setColor(*RED*)", font, 14, Vec2::ZERO, TextHAlignment::RIGHT, TextVAlignment::CENTER);
33353335
label[1]->setColor(Color3B::RED);
33363336

33373337
label[2] = Label::createWithSystemFont("SystemFont TextVAlignment::BOTTOM\nusingsetTextColor(*YELLOW)", font, 14,
33383338
Vec2::ZERO, TextHAlignment::CENTER, TextVAlignment::BOTTOM);
3339-
label[2]->setTextColor(Color4B::YELLOW);
3339+
label[2]->setTextColor(Color32::YELLOW);
33403340

33413341
label[3] = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "BMFont\nwith default color", TextHAlignment::CENTER, s.width);
33423342

33433343
label[4] = Label::createWithBMFont("fonts/bitmapFontTest5.fnt", "BMFont\nusing setTextColor(0, 255, 0, 100)",
33443344
TextHAlignment::CENTER, s.width);
3345-
label[4]->setTextColor(Color4B(0, 255, 0, 100));
3345+
label[4]->setTextColor(Color32(0, 255, 0, 100));
33463346

33473347
label[5] = Label::createWithTTF(ttfConfig, "TTF setColor(*BLUE*)\nwith multiline 1\nand a much more longer multiline 2",
33483348
TextHAlignment::LEFT, s.width);
33493349
label[5]->setColor(Color3B::BLUE);
33503350

33513351
label[6] = Label::createWithTTF("TTF setTextColor(*RED*)\nwith multiline 1\nand a much more longer multiline 2",
33523352
font, 14);
3353-
label[6]->setTextColor(Color4B::RED);
3353+
label[6]->setTextColor(Color32::RED);
33543354

33553355
for (int i = 0; i < count; i++)
33563356
{

0 commit comments

Comments
 (0)