|
Cube & Cube 2 FORUM
|
CVS: draw_textf color |
by Der/Nalia
on 03/28/2007 17:08, 4 messages, last message: 03/29/2007 07:10, 937 views, last view: 04/30/2024 02:52 |
|
While working on my mod, i came accross the need to color text. for example, when the kills are <=0 the text is red, and green if you have the most kills.
extern void draw_textf(const char *fstr, int r, int g, int b, int left, int top, ...);
void draw_textf(const char *fstr, int r, int g, int b, int left, int top, ...)
{
s_sprintfdlv(str, top, fstr);
draw_text(str, left, top, r, b, g);
};;
it works well... i hope many find it as useful as i do
|
|
Board Index
|
|
#1: .. |
by Der/Nalia
on 03/28/2007 19:56
|
|
woops.. typed it wrong.. that should be
void draw_textf(const char *fstr, int r, int g, int b, int left, int top, ...)
{
s_sprintfdlv(str, top, fstr);
draw_text(str, left, top, r, g, b);
};
reply to this message
|
|
#2: Re: coloured text |
by MeatROme
on 03/28/2007 21:12, refers to #1
|
|
Ahemm. "\f0" ... "\f3" ... it's already there ... 0:green, 1:blue, 2:yellow, 3:red
reply to this message
|
|
#3: Re: coloured text |
by MeatROme
on 03/28/2007 21:13, refers to #2
|
|
Of course you can modify r,g,b too - for more variation.
But ... how about just adding "\f4" .. "\f9" ... maybe continue with "\fa", "\fb" ... just a thought ;)
reply to this message
|
|
#4: .. |
by Der/Nalia
on 03/29/2007 07:10
|
|
I thought it would be better to have a full set of colors. for example. for the specific red i use for frags: 255,100,100
whereas another red i might use for something else could be pure 255,0,0
reply to this message
|
|
|
Board Index
|
|
Unvalidated accounts can only reply to the 'Permanent Threads' section!
|
|
|
|
|