MCPcopy Create free account
hub / github.com/axmolengine/axmol / enableOutline

Method enableOutline

core/2d/Label.cpp:1446–1483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1444}
1445
1446void Label::enableOutline(const Color4B& outlineColor, float outlineSize /* = -1 */)
1447{
1448 AXASSERT(_currentLabelType == LabelType::STRING_TEXTURE || _currentLabelType == LabelType::TTF,
1449 "Only supported system font and TTF!");
1450
1451 if (outlineSize > 0 || _currLabelEffect == LabelEffect::OUTLINE)
1452 {
1453 if (_currentLabelType == LabelType::TTF)
1454 {
1455 _effectColorF.r = outlineColor.r / 255.0f;
1456 _effectColorF.g = outlineColor.g / 255.0f;
1457 _effectColorF.b = outlineColor.b / 255.0f;
1458 _effectColorF.a = outlineColor.a / 255.0f;
1459
1460 if (outlineSize > 0 && _fontConfig.outlineSize != outlineSize)
1461 {
1462
1463 _fontConfig.outlineSize = static_cast<int>(outlineSize);
1464 setTTFConfig(_fontConfig);
1465 }
1466 if (_useDistanceField && outlineSize > 0)
1467 {
1468 _currLabelEffect = LabelEffect::OUTLINE;
1469 updateShaderProgram();
1470 }
1471 }
1472 else if (_effectColorF != outlineColor || _outlineSize != outlineSize)
1473 {
1474 _effectColorF.r = outlineColor.r / 255.f;
1475 _effectColorF.g = outlineColor.g / 255.f;
1476 _effectColorF.b = outlineColor.b / 255.f;
1477 _effectColorF.a = outlineColor.a / 255.f;
1478 _currLabelEffect = LabelEffect::OUTLINE;
1479 _contentDirty = true;
1480 }
1481 _outlineSize = outlineSize;
1482 }
1483}
1484
1485void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,
1486 const Vec2& offset /* = Vec2(2 ,-2)*/,

Callers 15

initMethod · 0.45
initMethod · 0.45
NonBatchSpritesMethod · 0.45
LabelTTFSDFMethod · 0.45
onEnterMethod · 0.45
LabelIssue11699TestMethod · 0.45
LabelSystemFontTestMethod · 0.45

Calls

no outgoing calls

Tested by 14

initMethod · 0.36
initMethod · 0.36
NonBatchSpritesMethod · 0.36
LabelTTFSDFMethod · 0.36
onEnterMethod · 0.36
LabelIssue11699TestMethod · 0.36
LabelSystemFontTestMethod · 0.36