|
2 registered members (TipmyPip, izorro),
556
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Panels / Window
#100407
11/29/06 23:12
11/29/06 23:12
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Hi, I want to create a panel where some text will be wrote on. For example, I have a background bmap and I want the text to appear in front of this background: RELATIVE HUMIDITY: X X will come from a variable that I created before. How will I make this work? Thanks and sorry for my noob-ing 
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Panels / Window
[Re: Marky Mark]
#100408
11/29/06 23:44
11/29/06 23:44
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
User
|
User
Joined: Mar 2006
Posts: 752
Portugal
|
Code:
font digit_font = <digit.pcx>,10,8; var humidity = 50;
panel mPanel { bmap = "myPanel.tga"; pos_x = 950; pos_y = 0; layer = 3; digits = 210,40,8,digit_font,1,humidity; flags = visible,refresh; }
function printLabels() { draw_textmode("Arial",1,15,100); draw_text("Relative Humidity:",970,40,vector(255,255,255)); }
Call the funtion printLabels(); in main.
|
|
|
Re: Panels / Window
[Re: demiGod]
#100409
11/30/06 03:24
11/30/06 03:24
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
If I change the screen resolution, will the display be messed up?
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Panels / Window
[Re: Marky Mark]
#100410
11/30/06 03:30
11/30/06 03:30
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
oh and BTW, how does my digit.pcx file have to looks like?
Last edited by Marky Mark; 11/30/06 03:31.
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Panels / Window
[Re: Marky Mark]
#100411
11/30/06 03:50
11/30/06 03:50
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
I worked a bit on it... Code:
font digit_f = <ackfont.pcx>,6,9; var humidity = 50;
panel cPanel { bmap = "condPanel.tga"; pos_x = 0; pos_y = 0; layer = 10; digits = 50,100,8,digit_f,1,humidity; //flags = visible,refresh; }
function printLabels() { draw_textmode("Arial",1,15,100); draw_text("Relative Humidity:",150,100,vector(255,255,255)); }
function showConditions() { printLabels(); cPanel.visible = on; freeze_mode = 1; }
on_o = showConditions(); Now when I press on O to show the conditions, The background panel opens, the game freeze, and I see the text "relative humidity" for something like 1/2 seconds. It's like the background is more important than the text. The "50" coming from the variable is appearing when I want. Maybe its a problem with the layers? Is there a better way to do this? It seems like I'll have to recode everything depending on the game's resolution screen....
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Re: Panels / Window
[Re: Marky Mark]
#100412
11/30/06 06:21
11/30/06 06:21
|
Joined: Aug 2005
Posts: 1,558 HK
vlau
Serious User
|
Serious User
Joined: Aug 2005
Posts: 1,558
HK
|
draw_text and draw_textmode write the string for 1 frame only, you need to add a while loop to keep it displaying on screen permanently. In fact, you can print the string "Relative Humidity:" on your panel with the following codes : Code:
font arial_font = "Arial",1,15;
panel cPanel { bmap = "condPanel.tga"; pos_x = 0; pos_y = 0; layer = 10;
digits = 150,100,"Relative Humidity:",arial_font,1,0;
digits = 50,100,8,digit_f,1,humidity; //flags = visible,refresh; }
digits are not limited to numbers, strings are also available.
|
|
|
Re: Panels / Window
[Re: demiGod]
#100414
12/02/06 04:08
12/02/06 04:08
|
Joined: Aug 2005
Posts: 1,185 Ukraine
Lion_Ts
Serious User
|
Serious User
Joined: Aug 2005
Posts: 1,185
Ukraine
|
I'm using Vlau's method. And you may use TEXT object with higher layer number, alighned over your panel. Print your text into TEXT's string array. Code:
... text hint = { font = _font; layer = 15; pos_x = 15; pos_y = 20; size_y = 100; offset_y = 0; strings = 1; flags = center_x, narrow, transparent, visible; } ... str_cpy(hint.string[0], t_str); ...
You can do every thing by different way 
Last edited by Lion_Ts; 12/02/06 04:12.
|
|
|
Re: Panels / Window
[Re: Lion_Ts]
#100415
12/02/06 14:52
12/02/06 14:52
|
Joined: Jul 2002
Posts: 857 Québec
Marky Mark
OP
User
|
OP
User
Joined: Jul 2002
Posts: 857
Québec
|
Lion-Ts , I dont understand how your code works... where do I put the text ?
Yeah! IE sucks, use Mozilla... Marc Rémillard.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|