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

Method enableShadow

core/2d/Label.cpp:1485–1532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1483}
1484
1485void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,
1486 const Vec2& offset /* = Vec2(2 ,-2)*/,
1487 int /* blurRadius = 0 */)
1488{
1489 _shadowEnabled = true;
1490 _shadowDirty = true;
1491
1492 _shadowOffset.width = offset.width;
1493 _shadowOffset.height = offset.height;
1494 // TODO: support blur for shadow
1495
1496 _shadowColor3B.r = shadowColor.r;
1497 _shadowColor3B.g = shadowColor.g;
1498 _shadowColor3B.b = shadowColor.b;
1499 _shadowOpacity = shadowColor.a;
1500
1501 if (!_systemFontDirty && !_contentDirty && _textSprite)
1502 {
1503 auto fontDef = _getFontDefinition();
1504 if (_shadowNode)
1505 {
1506 if (shadowColor != _shadowColor4F)
1507 {
1508 _shadowNode->release();
1509 _shadowNode = nullptr;
1510 createShadowSpriteForSystemFont(fontDef);
1511 }
1512 else
1513 {
1514 _shadowNode->setPosition(_shadowOffset.width, _shadowOffset.height);
1515 }
1516 }
1517 else
1518 {
1519 createShadowSpriteForSystemFont(fontDef);
1520 }
1521 }
1522
1523 _shadowColor4F.r = shadowColor.r / 255.0f;
1524 _shadowColor4F.g = shadowColor.g / 255.0f;
1525 _shadowColor4F.b = shadowColor.b / 255.0f;
1526 _shadowColor4F.a = shadowColor.a / 255.0f;
1527
1528 if (_currentLabelType == LabelType::BMFONT || _currentLabelType == LabelType::CHARMAP)
1529 {
1530 updateShaderProgram();
1531 }
1532}
1533
1534void Label::enableItalics()
1535{

Callers 9

initMethod · 0.45
initMethod · 0.45
initMethod · 0.45
LabelTTFSDFMethod · 0.45
onEnterMethod · 0.45
sliderEventMethod · 0.45

Calls 2

releaseMethod · 0.45
setPositionMethod · 0.45

Tested by 6

initMethod · 0.36
initMethod · 0.36
initMethod · 0.36
LabelTTFSDFMethod · 0.36
onEnterMethod · 0.36
sliderEventMethod · 0.36