Font colour

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

Moderators: CEGUI MVP, CEGUI Team

E.Kiver
Just popping in
Just popping in
Posts: 12
Joined: Tue Oct 09, 2007 18:56

Font colour

Postby E.Kiver » Thu Jan 17, 2008 23:33

Hi!
Thanks a lot, for fast response on my previous posts.
The question for today is: How to set font color in external .font file?
Is there something like DefaultColour="0xFFFFFFFF" ?
Or at least in game code

EDIT: Ok Soved It, declaring
Property Name="TextColours" Value="tl:FF00000000 tr:FF000000 bl:FF000000 br:FF000000" />
in my .layout file helps.
Anyway, how to change font colour dynamicly within the game code?

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

Postby CrazyEddie » Fri Jan 18, 2008 09:41

Hi,

The font does not have a colour associated with it - the colours are set individually on each window. How this is done exactly depends on the window type and maybe other things.

To change the colours at runtime, you can either use the setProperty call on the window (passing strings like you do in the layout), or depending on the exact window type there may be a direct setter (though most of these were phased out where it was possible) - you'll have to check the API docs for this since you did not specify which window type it is.

Arcanor
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Sat Jan 27, 2007 14:03
Contact:

Postby Arcanor » Fri Mar 07, 2008 21:27

I'm using a MultiLineEditBox for the output of a chat/info window. How can I set specific words that are output to be different colors/bold/etc.?

I'd love to set a FontColour property at runtime, but unfortunately I don't think MultiLineEditBox accepts that property.

Alternatively, should I be using a different type of control for chat/info output rather than MultiLineEditBox?

TIA.
Arcanoria - a SMORPG project - http://www.arcanoria.com

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

Postby CrazyEddie » Sat Mar 08, 2008 08:54

Hi,

You can set the text colour on the MultiLineEditbox via the property "NormalTextColour"; though obviously this changes the colour of all the text and I'm guessing this is not what you want.

There is currently no quick and easy way to colour substrings (via a markup like tag, for instance). This is a much requested feature, and I have some ideas for implementation of this (in a very customisable way) for a future release, though that does not help you now.

For the chat/info window many people use Listbox instead; with each entry in the list being a line or entry in the chat output. This gives you the means to have each item / entry / line a different colour. If you were to create a custom window skin (for items added to ItemListbox) or a customised ListboxItem (for the older Listbox type), it would be possible to have 'fields' in each line that you could colour individually as required.

CE.

Arcanor
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Sat Jan 27, 2007 14:03
Contact:

Postby Arcanor » Sat Mar 08, 2008 11:01

Thanks CE I'll give your Listbox suggestion a try.

Since you mentioned a future version of CEGUI, do you think it's something that might be released within the next 6 months, or is it a more vague plan than that? I'd be very excited to see more progress on CEGUI after all this time! There are currently quite a few competing GUI solutions for Ogre (i.e. QuickGUI, MyGUI, Navi, etc.), but none of them yet has the completeness and stability of CEGUI.
Arcanoria - a SMORPG project - http://www.arcanoria.com

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

Postby CrazyEddie » Sat Mar 08, 2008 15:05

Hi,

We have intention to release what is currently in trunk sometime really soon. While there is not likely to be anything earth shattering in that release, obviously after 16 months there are a lot of fixes and some new things as well (like a tree widget). One of the main purposes of such a release, at least as far as I am concerned, is to draw a line under what has gone before in order to subsequently move onto bigger and better things.

A further release within six months, containing new CEGUI development, is not totally unrealistic - providing things hold together :lol:

CE.

Arcanor
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Sat Jan 27, 2007 14:03
Contact:

Postby Arcanor » Sat Mar 08, 2008 18:09

Thanks CE, and great to see you back!
Arcanoria - a SMORPG project - http://www.arcanoria.com

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Mar 10, 2008 13:12

You should have a look at Game Chat Box. That code allows you to use dynamic fonts (arial 10, 12, 16, etc, times new roman, etc).

There was a post with some code to wrap the text within a listbox text item. [need a link to that post]

Arcanor
Not too shy to talk
Not too shy to talk
Posts: 38
Joined: Sat Jan 27, 2007 14:03
Contact:

Postby Arcanor » Mon Mar 10, 2008 13:55

Thanks Rackle. I did actually use that wiki page to help me get my Listboxes going (they work great now).

However, I didn't get as far as experimenting with dynamic fonts or long line wrapping yet. I will give them a try!
Arcanoria - a SMORPG project - http://www.arcanoria.com


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests