www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/06/18:11:45

From: "CORNU.Nicolas" <CORNU DOT Nicolas AT wanadoo DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: problem with ALLEGRO bitmaps in a typedef structure (maybe "call by reference")
Date: Tue, 6 Apr 1999 23:43:51 +0200
Organization: Wanadoo, l'internet avec France Telecom
Lines: 60
Message-ID: <7edve6$mcc$1@wanadoo.fr>
NNTP-Posting-Host: meaux13-37.abo.wanadoo.fr
X-Trace: wanadoo.fr 923435270 22924 164.138.33.37 (6 Apr 1999 21:47:50 GMT)
X-Complaints-To: abuse AT wanadoo DOT fr
NNTP-Posting-Date: 6 Apr 1999 21:47:50 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

in fact my problem is that i want to draw a pic into a member of a typedef
struct (vehicule_model)

typedef struct vehicule_model
{
 BITMAP *thing1;
}

for that i use a function located in other .c file.
when i call first the function (ini_vehicule) to create the bitmap
(create_bitmap).

***** in truc.c: *****

#include ...

int ini_vehicule (vehicule_model veh)
{
 veh.thing1 = create_bitmap(64, 64);
}
***** end *****

***** in main.c: *****
...
vehicule_model car;
...
ini_vehicule(car);
blit ( datessai[essai].dat, car.thing1, 0, 0, 0, 0, 64, 64);
blit ( car.thing1, screen, 0, 0, 200,200, 64, 64);
...
***** end *****

no error, when i display it on the screen, using blit function, no pic
is displayed.

i don't know how i must declare my variable "car" with the type of
vehicule_model...
In fact i want the function ini_vehicule to do something with a variable
passed in arguments.

i've read that "call by reference" done what i want.
i have tryed this, instead of:

ini_vehicule(car):

i've wrote

ini_vehicule(&car)


is it the good way ?


--
CORNU Nicolas
E-mail: CORNU DOT Nicolas AT wanadoo DOT fr
ICQ: 31463000
Homepage: http://perso.wanadoo.fr/nicolas.cornu/Index.htm


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019