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

Method enableGlow

core/2d/Label.cpp:1414–1444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1412}
1413
1414void Label::enableGlow(const Color4B& glowColor, float glowRadius)
1415{
1416 if (glowRadius <= 0)
1417 glowRadius = FontFreeType::DistanceMapSpread / 2.0f;
1418
1419 if (_currentLabelType == LabelType::TTF && (glowRadius > 0 || _currLabelEffect == LabelEffect::GLOW))
1420 {
1421 _glowRadius = glowRadius;
1422
1423 auto config = _fontConfig;
1424 int mods = 0;
1425 // Note: axmol only support Glow effect in SDF rendering mode
1426 if (!_fontConfig.distanceFieldEnabled)
1427 {
1428 config.distanceFieldEnabled = true;
1429 ++mods;
1430 }
1431 if (mods)
1432 {
1433 setTTFConfig(config);
1434 _contentDirty = true;
1435 updateShaderProgram();
1436 }
1437 _currLabelEffect = LabelEffect::GLOW;
1438 _effectColorF.r = glowColor.r / 255.0f;
1439 _effectColorF.g = glowColor.g / 255.0f;
1440 _effectColorF.b = glowColor.b / 255.0f;
1441 _effectColorF.a = glowColor.a / 255.0f;
1442 updateShaderProgram();
1443 }
1444}
1445
1446void Label::enableOutline(const Color4B& outlineColor, float outlineSize /* = -1 */)
1447{

Callers 10

initMethod · 0.45
LabelTTFSDFMethod · 0.45
onEnterMethod · 0.45
LabelIssue10688TestMethod · 0.45

Calls

no outgoing calls

Tested by 7

initMethod · 0.36
LabelTTFSDFMethod · 0.36
onEnterMethod · 0.36
LabelIssue10688TestMethod · 0.36