Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Nymphodora, AndrewAMD, TipmyPip, Quad, Imhotep), 847 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to change text color? #221450
08/14/08 03:30
08/14/08 03:30
Joined: Jun 2008
Posts: 40
pfeldman Offline OP
Newbie
pfeldman  Offline OP
Newbie

Joined: Jun 2008
Posts: 40
I have a PANEL that looks like this:

PANEL* panDisplay= {
digits(100, 300, "# 1: %0.1f", "Arial#60b", 1, t_1);
digits(450, 300, "# 2: %0.1f", "Arial#60b", 1, t_2);
flags= VISIBLE;
}

t_1 and t_2 are the remaining times for players 1 and 2, respectively. I'd like to change the color of the text to red to warn a player when his time falls below 60 seconds. It seems as though it should be possible to do this using pan_setvar(), but I haven't been able to figure out how, and there are no examples of this. Any advice will be appreciated.

Dr. Phillip M. Feldman

Re: how to change text color? [Re: pfeldman] #221467
08/14/08 07:44
08/14/08 07:44
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I think you'll need to use one or two TEXT* objects.
Check the manual, but they function very like the digits commands,
but they are separate objects to the panel, so you'll need to position
the TEXT objects over the top of your panel.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: how to change text color? [Re: EvilSOB] #221490
08/14/08 10:00
08/14/08 10:00
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
Code:
vec_set(panDisplay.blue,vector(0,0,255));


or:

Code:
panDisplay.red = 255;
panDisplay.green = 0;
panDisplay.blue = 0;


Re: how to change text color? [Re: Scorpion] #221532
08/14/08 15:01
08/14/08 15:01
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
if it's always consistent then set it directly
PANEL* panDisplay= {
digits(100, 300, "# 1: %0.1f", "Arial#60b", 1, t_1);
digits(450, 300, "# 2: %0.1f", "Arial#60b", 1, t_2);
red = 255; green = 0; blue = 0;
flags= VISIBLE;
}

Re: how to change text color? [Re: MrGuest] #221571
08/14/08 21:25
08/14/08 21:25
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Both Scorp and MrGuest are right but have missed the point that the request
for different lines of the panel have different colors.
The code they supplied will set the color for the text of the whole panel, so
unless you put two separate panels right next to each other it wont help.
Unless of course, I've misunderstood the question and so apologise.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: how to change text color? [Re: EvilSOB] #221588
08/15/08 00:15
08/15/08 00:15
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
yeh, i don't believe there is a mechanism that allows you to color digits, or other elements of a panel, individually.

pan_setvar will only set variables, it wont change constants like size, limits, color.

I guess you will have to create 2 seperate objects, unless you can pursuade JCL to add this.

Re: how to change text color? [Re: DJBMASTER] #221785
08/16/08 13:02
08/16/08 13:02
Joined: Dec 2003
Posts: 521
LazyDog Offline
User
LazyDog  Offline
User

Joined: Dec 2003
Posts: 521
instead of using a panel you could use draw_textmode and draw_text.
each draw_text can use it's own color settings.

check them out in the manual.


www.LazyDogSoftware.com
Delphi SDK Homepage

A7 Pro 780
Delphi 5 through 2010
Re: how to change text color? [Re: LazyDog] #221789
08/16/08 13:26
08/16/08 13:26
Joined: Jul 2005
Posts: 187
L
lostzac Offline
Member
lostzac  Offline
Member
L

Joined: Jul 2005
Posts: 187
I have been following this topic since it started, and you know I never even thought of using draw_text....lol....Thats a good idea and probably the best way of handling something like this. KUDOS to you LazyDog


John C Leutz II

Re: how to change text color? [Re: lostzac] #221794
08/16/08 13:48
08/16/08 13:48
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
personally i would prefer 2 TEXT* objects...

draw_textmode is a slow function and it's not wise to set it lots of times in the same frame.

Re: how to change text color? [Re: DJBMASTER] #222354
08/18/08 23:09
08/18/08 23:09
Joined: Dec 2003
Posts: 521
LazyDog Offline
User
LazyDog  Offline
User

Joined: Dec 2003
Posts: 521
yes draw_textmode is slow, but if you only need to use 1 font then setting this one time before your main loop allows you to use draw_text to change the colors to your hearts delight and draw_text is fast.

so basically it depends on your situation.


www.LazyDogSoftware.com
Delphi SDK Homepage

A7 Pro 780
Delphi 5 through 2010

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1