TextBlock2DSharedPtr       leftTextPtr;

TextBlock2DSharedPtr       midTextPtr;

TextBlock2DSharedPtr       rightTextPtr;

TextBlock3DSharedPtr       textBlock3DPtr;

BrushResourceSharedPtr   buleColorBrushPtr;

BrushResourceSharedPtr   whiteColorBrushPtr;

 

leftTextPtr         =getRoot()->lookupNode<TextBlock2D>("./Stack Layout2D/LeftText");

midTextPtr        =getRoot()->lookupNode<TextBlock2D>("./Stack Layout2D/MidText");

rightTextPtr       =getRoot()->lookupNode<TextBlock2D>("./Stack Layout2D/RightText");

textBlock3DPtr  =getRoot()->lookupNode<TextBlock3D>("./Viewport 2D/Scene/TextBlock 3D");

 

ResourceManager* resourceMana= getResourceManager();

buleColorBrushPtr  =resourceMana->acquireResource<BrushResource>("kzb://fonthighlight/Brushes/BuleColor");

whiteColorBrushPtr=resourceMana->acquireResource<BrushResource>("kzb://fonthighlight/Brushes/WhiteColor");

 

leftTextPtr->setText("zhang");

leftTextPtr->setForegroundBrush(whiteColorBrushPtr);

midTextPtr->setText("ze");

midTextPtr->setForegroundBrush(buleColorBrushPtr);

rightTextPtr->setText("long");

rightTextPtr->setForegroundBrush(whiteColorBrushPtr);

 

ColorRGBAfontColor;

fontColor.setRed(233);

fontColor.setGreen(105);

fontColor.setBlue(91);

fontColor.setAlpha(255);

textBlock3DPtr->setFontColor(fontColor);

textBlock3DPtr->setFontMaterialResourceID(ResourceID("kzb://fonthighlight/Materials/TestFontMaterial"));

[kanzi]为设置3DTextBlock的颜色Demo[kanzi]为设置3DTextBlock的颜色Demo


相关文章:

  • 2021-06-19
  • 2021-12-07
  • 2021-10-14
  • 2021-08-15
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
猜你喜欢
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2021-12-24
相关资源
相似解决方案