axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
868 stars 195 forks source link

[Feature] Add setString for ui::RichText #1168

Closed halx99 closed 1 year ago

halx99 commented 1 year ago

Discussed in https://github.com/axmolengine/axmol/discussions/1166

Originally posted by **antn9x** April 5, 2023 I’d like to change my RichText’s content from "abc", to "def", but it’s not clear how. There’s no setString equivalent, and the closest is just calling initWithXML, but that comes with its own issues since the old renderer nodes are still present. ``` auto rich_text = cocos2d::ui::RichText::createWithXML("abc"); rich_text->setString("def"); //setString doesn't exist rich_text->initWithXML("def"); //incorrectly renders both 'abc' and 'def' next to each other ```
halx99 commented 1 year ago

Done with commit: https://github.com/axmolengine/axmol/commit/a4e75d47a77b0e6ccb7a402e839a25dcb033d4c2