From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: "load_bitmap" newbie... Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: <5q0bls8jr5vfik15v20j9fdn8m303rhe3h@4ax.com> References: <39553338_2 AT spamkiller DOT newsfeeds DOT com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 79 X-Trace: +Sz2ra/IX22pPmwAakhoV3ADUQcWUvlRCeqigFM45RmnZeatechmCPeyoa+8DTI9ixV93H1gLbhU!XbjbIf7NpAp9SUKbsTRNLJ5hcuonuwZUsl9H9Bhy4qWuAWDE85vAO6/KQWUiDCjhpZRAnh5JALFP!5w== X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Sun, 25 Jun 2000 04:04:48 GMT Distribution: world Date: Sun, 25 Jun 2000 04:04:48 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sat, 24 Jun 2000 17:08:40 -0500, "23yrold3yrold" wrote: >I'm having trouble using some functions in Allegro; I think the documents >assume a little too much (or I'm just dense). I've been trying to learn by >reading bloddy near every source of Allegro tutorials on the Net but I get >things like the following. I know it should work (according to Allegro's >accompanying documentation) and it's copied exactly as is out of a tutorial. >I also know I'm missing something simple, and hope someone will be kind >enough to share. I have a bitmap called Test.bmp and it's 32 x 32, in the >same folder as the executable, but I can't figure out where in the program >the name of it should go (knowing my luck I have to put it a few places). >The compiler gets this far before it stops and returns an error. Much thanx >to whomever schools me in this. > >#include >#include > >#include "allegro.h" If you did a "make install" it should be #include >BITMAP *pic; >PALETTE pal; > >int x,y; > >main(void) Best to specify the return type of main() int main(void) or better yet, to leave yourself open for commandline arguments and/or drag-and-drop files onto your icon: int main(const int argc, const char **argv) >{ >allegro_init(); install_timer() should always be the first routine you call after allegro_init(). The keyboard and mouse routines depend on it. > install_keyboard(); > set_color_depth(16); > set_gfx_mode(GFX_AUTODETECT,640,480,0,0); On systems (X, Windows) where the OS provides input via events, the keyboard should be started _after_ the graphics mode is set. Think portability. > load_bitmap(pic,pal); > >Error: passing 'BITMAP *' as argument 1 of 'load_bitmap(char*, RGB*)' pic = load_bitmap("precious_moments.pcx", pal); Then finish the program: blit(pic, screen, 0, 0, 0, 0, pic->w, pic->h); destroy_bitmap(pic); // equivalent of free() for BITMAP * readkey(); return 0; } END_OF_MAIN(); Some systems (Eunuchs, Windows) require END_OF_MAIN() (an Allegro 3.9.x feature) immediately following the closing brace of main(). Again, portability. -- Damian Yerrick "I refuse to listen to those who refuse to listen to reason." See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html This is McAfee VirusScan. Add these two lines to your signature to prevent the spread of signature viruses. http://www.mcafee.com/