How 2 render text with different colors in one window?

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

How 2 render text with different colors in one window?

Postby singbol » Sun Sep 06, 2009 09:16

Hi,
I'm here for game's chatting window, I want to make the text showed in the window with different colors, likes:
//////////////////////////////////////
//[clr green]Hey[/clr green],[clr red]I want//
//to be a [/clr red][clr brown]good man //
//[/clr brown]and [smiles 1]~@~[/smiles 1//
//////////////////////////////////////

How can I get this effect?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: How 2 render text with different colors in one window?

Postby CrazyEddie » Sun Sep 06, 2009 11:10

We're only adding integrated support for this type of thing starting with the 0.7.0 release (that should be made around next weekend, give or take a few days).

To do this in earlier versions you'll need to come up with some custom solution whereby you manually split the string into component sub-strings and draw them all separately; how exactly you do this, and how easily it's achieved (the rendering part, I mean) will depend upon the type of element you're rendering - there's unlikely to be a generic solution without modifying the CEGUI code, but if you're going that route, you might as well use the v0-7 code that already contains some level of support for this.

CE.

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How 2 render text with different colors in one window?

Postby singbol » Sun Sep 06, 2009 11:57

:D
Glad to hear that~~~I'm so excited !
and how about the world map?I've already written one but not support circle one~~~(I mean the map looks like circle)
Waiting for your fruit!! :wink:

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: How 2 render text with different colors in one window?

Postby CrazyEddie » Mon Sep 07, 2009 08:44

Circular elements are much more of a challenge; probably not impossible, but to have a circular style mini-map, perhaps like in WoW, much more would have to be done on the app side, since such support is not integrated in CEGUI.

CE.

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How 2 render text with different colors in one window?

Postby singbol » Tue Sep 08, 2009 01:48

Ok, then I know I have to do it by myself~ :(
Another question, is it easy to make this style of tabcontrol like following:
////// ////// //////
Tab1 Tab2 Tab3
////// ////// //////
/////// /////// ///////
Tab4 Tab5 Tab6
/////// /////// ///////
I mean the multiline tabs, now I implement it just by using image buttons and control the
child window manually.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: How 2 render text with different colors in one window?

Postby CrazyEddie » Tue Sep 08, 2009 09:23

IIRC the tab control has the scroll buttons when there are too many tabs buttons, as far as I'm aware it does not currently support multiple rows of tab buttons.

CE.

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How 2 render text with different colors in one window?

Postby singbol » Tue Sep 08, 2009 15:27

Ok, In all, Thank you for your patient reply~!~I think I should use image buttons to simulate that.


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests