From: gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk (George Foot) Newsgroups: comp.os.msdos.djgpp Subject: Re: Problems with palette in Allegro. Date: 21 Feb 1997 00:27:31 GMT Organization: Oxford University Lines: 27 Distribution: world Message-ID: <5eiq5j$k1n@news.ox.ac.uk> References: NNTP-Posting-Host: mc31.merton.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp David Jenkins (me AT jenkinsdavid DOT demon DOT co DOT uk) wrote: : I only need two colours for this program so can I set up a screen which : only uses a palette of 2??? Allegro only supports 256-colour modes. But you needn't set the palette entries for all the colours. : int rand(); You shouldn't redefine standard functions - rand() is already defined in stdlib.h, which you have #included. The problem with your program is that you've put things in the wrong order. Changing the video mode resets the palette, so your custom palette is not used. First you should do the allegro_init(), then change video mode, and finally set up your palette. : putpixel(screen, rand() % SCREEN_W - 1, rand() % SCREEN_H - 1, : c); Hmm. I would just use random()%SCREEN_W, etc. Not that important, though... some of your points might not be on the screen. -- George Foot Merton College, Oxford.