www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/26/19:06:00

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro: Pallete problems...
Date: Wed, 26 Feb 1997 20:27:37 +0000
Organization: None
Distribution: world
Message-ID: <vHm4GGA5yJFzEwIJ@talula.demon.co.uk>
References: <199702251828 DOT SAA09913 AT post DOT dialin DOT co DOT uk>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 36
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019