Mail Archives: djgpp/1997/02/21/01:02:05
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 <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
Merton College, Oxford.
- Raw text -