Mail Archives: djgpp/1997/02/26/19:06:00
Lee Simons writes:
> BITMAP *titlescreen;
> PALLETE pallete;
>
> titlescreen = load_pcx("titlescr.pcx", pallete);
>
> blit(titlescreen, screen, 0, 0, (SCREEN_W-titlescreen->w)/2,
> (SCREEN_H-titlescreen->h)/2, titlescreen->w,
Almost right! You'r displaying the bitmap correctly, but as well as
blitting the pixels onto the screen, you have to tell the graphics
hardware which color palette you are using. If you insert a
set_pallete(pallete) just before the blit, it should look much nicer :-)
> field = load_pcx("field.pcx", pallete);
> player = load_pcx("player.pcx", pallete);
>
> blit(player, screen, 0, 0, (SCREEN_W-player->w)/2,
> (SCREEN_H-player->h)/2, player->w, player->h);
>
> blit(field, screen, 0, 0, (SCREEN_W-field->w)/2,
> (SCREEN_H-field->h)/2, field->w, field->h);
Again, you need to select the palette before you display the images.
This will be fine if field.pcx and player.pcx use the same palette as
the title screen bitmap, otherwise you will need to select a different
one. To display two images at the same time, though, you'll need to make
sure they are both using the same palette, because the palette registers
in the VGA hardware are global and affect everything on the screen. This
means you might need to alter one of the files to make sure it uses the
same palette as the other...
/*
* Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
* Beauty is a French phonetic corruption of a short cloth neck ornament.
*/
- Raw text -