Skip to main content
GameDev.net gamedev.net
🔒 Locked

CEGUI Change static text style inline

Started by Gykonik Mar 25, 2016 at 9:14 PM 1 replies 1.9k views
Original Post
Gykonik
Gykonik

I have a CEGUI-Window with static text in it. I also gave the text a style and the window a scroll bar, if the text is too long, to fit in the window.

Here is the Code, how I create the window and the text:


CEGUI::DefaultWindow* test = static_cast<CEGUI::DefaultWindow*>(m_gui.createWidget("TaharezLook/StaticText", glm::vec4(0.6f, 0.6f, 0.4f, 0.4f), glm::vec4(0.0f), "levelWindowTest"));
test->setText("Heading\n\nThis is a test for DefaultWindow with scrollable static text. \nContent\nContent\nContent\nContent\nContent\nContent\nContent\nContent");
test->setProperty("TextColours", "tl:FFFF0000 tr:FFFF0000 bl:FFFF0000 br:FFFF0000");
test->setProperty("VertScrollbar", "True");
test->setProperty("VertFormatting", "VertCentred");
test->setProperty("HorzFormatting", "HorzCentred");
test->setProperty("HorzFormatting", "WordWrapLeftAligned");

Now I want to set the style of the Text inline, so I can have multiple styles.

E.G. "Heading" should be larger and bold and "This is a test for DefaultWindow with scrollable static text" should be italic.

Now my question is:

Is there a way, how to set the style of the text in the setText()-Function or is there a other way, how I can have multiple styles for it?

Gykonik
Gykonik

Nice, thank you ^^

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.