Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
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
3 registered members (fairtrader, AndrewAMD, 3run), 576 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
panel.bmap per paramenter zuweisen #204826
05/01/08 21:41
05/01/08 21:41
Joined: Jul 2007
Posts: 288
Germany, NRW
Martek Offline OP
Member
Martek  Offline OP
Member

Joined: Jul 2007
Posts: 288
Germany, NRW
Hallo allezusammen,

ich tüfltel schon eine geraume Weile an einer funktion die einen Panel erstellen soll.
Diese funktion hat einen Paramenter, das das Bild des Panels bestimmt.
Ich bekomme es aber einfach nicht gebacken, dies zum laufen zu bringen.
Hier sind meine bisherigen Versuche die alle nicht funktioniert haben:
 Code:
function add_item_small(char* bild)
{
	pan_create("flags = visible; bmap = bild;",5);
}

function add_item_small(BMAP* bild)
{
	pan_create("flags = visible; bmap = bild;",5);
}


Ich habe Bild einmal als: "item1.bmp" angegeben und einmal als item1_bmp.

Vielleicht könnt ihr mir da ja weiterhelfen
Mfg, Martek


3D Gamestudio A7 Extra
Re: panel.bmap per paramenter zuweisen [Re: Martek] #204831
05/01/08 22:24
05/01/08 22:24
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
"flags = visible; bmap = bild;" is a char array constant as you put it into "s and therefore variables within won't be recognized by the compiler. You can do it like this:
 Code:
function add_item_small(char* bild)
{
	STRING* s = str_create(""); // use a string to put things together
	str_cpy(s,"flags = visible; bmap = ");
	str_cat(s,bild);
	str_cat(s,";");
	pan_create(s,5); // Now you can create the panel
	ptr_remove(s); // dont forget to free the string.
}



Last edited by Uhrwerk; 05/01/08 23:46. Reason: *ATOMROFL* @ Joey

Always learn from history, to be sure you make the same mistakes again...
Re: panel.bmap per paramenter zuweisen [Re: Martek] #204834
05/01/08 22:43
05/01/08 22:43
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
 Code:
function add_item_small(char* bild)
{
    const char *panInfo = "flags = visible; bmap = ";
    char *arg = (char*)malloc(sizeof(char) * (strlen(panInfo) + strlen(bild) + 2));
    str_cpy(arg, panInfo);
    str_cat(arg, bild);
    str_cat(arg, ";\0");
    pan_create(arg, 5);
}


ich hab den code nicht getestet. du solltest allerdings dringend ein tutorial über lite-c lesen...

joey.

edit: och menno. schon wieder der.

Last edited by Joey; 05/01/08 22:44. Reason: someone was quicker

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