Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Panels / Window #100407
11/29/06 23:12
11/29/06 23:12
Joined: Jul 2002
Posts: 857
Québec
Marky Mark Offline OP
User
Marky Mark  Offline 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 Offline
User
demiGod  Offline
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 Offline OP
User
Marky Mark  Offline 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 Offline OP
User
Marky Mark  Offline 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 Offline OP
User
Marky Mark  Offline 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
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

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: vlau] #100413
11/30/06 11:11
11/30/06 11:11
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Yeah, like vlau said you need to call printLabels() in a while loop.

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 Offline
Serious User
Lion_Ts  Offline
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 Offline OP
User
Marky Mark  Offline 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.

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