Page 1 of 1
Font colour
Posted: Thu Jan 17, 2008 23:33
by E.Kiver
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?
Posted: Fri Jan 18, 2008 09:41
by CrazyEddie
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.
Posted: Fri Mar 07, 2008 21:27
by Arcanor
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.
Posted: Sat Mar 08, 2008 08:54
by CrazyEddie
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.
Posted: Sat Mar 08, 2008 11:01
by Arcanor
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.
Posted: Sat Mar 08, 2008 15:05
by CrazyEddie
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
CE.
Posted: Sat Mar 08, 2008 18:09
by Arcanor
Thanks CE, and great to see you back!
Posted: Mon Mar 10, 2008 13:12
by Rackle
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]
Posted: Mon Mar 10, 2008 13:55
by Arcanor
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!