From: "Christopher Nelson" To: Subject: Re: i have some questions :) Date: Wed, 24 Mar 1999 15:31:33 -0700 Message-ID: <01be7646$11c89960$LocalHost@thendren> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.71.1712.3 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Reply-To: djgpp AT delorie DOT com -----Original Message----- From: Adam Schrotenboer To: djgpp AT delorie DOT com Date: Wednesday, March 24, 1999 4:13 AM Subject: Re: i have some questions :) >Et1850 wrote: > >> Some Questions >> >> 1. how do i get and r,g,b, into a one diget color. rgb needs three numbers but >> the command in allegro want one number. >> >> >> RGB mycolor = {43,56,123}; *rgb colors here are ex. This is simple. In Allegro use makecol(r, g, b). This automatically looks up your current color_depth and uses hardware-specific routines to shift it in place. In 15 and 16 bit modes this is the ONLY way to get accurate color, as most SVGA chips and many cards have different packing formats. 24-bit is simple, (r<<16) | (g<<8) | b. 32-bit color is identical, but it has an extra byte at the end (24-31) so that it's a dword move. this allows faster access, but it's bigger. in 8-bit modes this is a problem because it must look up the nearest matching value. for 8-bit modes you should simply set the palette, and then know what colors you want. also note that, in 8-bit modes the maximum value for r,b,g is 63, whereas in the other modes (15-32) the maximum is 255. >> >> set_color = (0,mycolor); *Wrong, mycolor is not const >> (0,&mycolor) *Wrong, mycolor is not int >> looking to mask sprites. but can't figure out my colors. (did it in windows >> using hex colors). so how would i get grey or pink (24-bit). also need to >> use colors for gui. in 8-bit modes just use 0 as the mask color. in 15, 16, 24, and 32-bit modes the color is makecol(255,0,255). >> 2. when getting .bmp or .pcx files(pics) from a data file is there a way to >> index to the next file without calling the name of the pic i have chose >> >> BASIC Ex. >> for i=0 to eof >> bmp = i >> next i >> >> if so that would shrink my code down considerably. :) there is... in a way. what you have to do is get all the files you want to access at once in one datafile. save that datafile under another datafile. have the dat utility generate a header file (i think it's the -h option). the header file will have a #define inside with the name of the datafile, eg, MYPICS_DAT, it will also have a count define telling how many objects are inside, eg. MYPICS_DAT_COUNT. then, when you go to load it, do this: DATAFILE *dfile = load_dat(filename); DATAFILE *mypics = (DATAFILE *)dfile[MYPICS_DAT]->data; BITMAP *mybmps[MYPICS_DAT_COUNT]; for(i=0; idata; } 3. -- Dialogs i cannot help you with, because i personally don't like Allegro's dialog functions. >> >> 4. i get strange errors in something called sigxxx ? these are signals, like exceptions. (in fact, they are exceptions, it's just that UNIX calls them signals. sigsegv means you wrote into memory you don't own. sigabort is a general protection error, etc. >> 5. how would one create a .h file so that way i could add them as new libs to >> djgpp? >> I don't understand the question.