delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/31/07:26:32

From: "Al Amzeen (Alexandr Amzin)" <amzeen AT cadsoft DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: using static bitmap *
Date: Fri, 31 Mar 2000 11:23:06 +0400
Organization: Fidolook Express page http://fidolook.da.ru
Lines: 43
Message-ID: <8c1l8v$2280$1@gavrilo.mtu.ru>
References: <iYWE4.2147$pR DOT 22570 AT carnaval DOT risq DOT qc DOT ca>
NNTP-Posting-Host: ppp98-117.dialup.mtu-net.ru
X-Trace: gavrilo.mtu.ru 954488928 67840 212.188.98.117 (31 Mar 2000 07:48:48 GMT)
X-Complaints-To: usenet-abuse AT mtu DOT ru
NNTP-Posting-Date: 31 Mar 2000 07:48:48 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Fidolook Express V1.51rus for MS OE 5.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Greetings, Yannick Benoit <yannick DOT benoit AT dr DOT cgocable DOT ca>! You wrote:
> hi
> I got 2 bitmap that id like to use for a game,1 is background and 1 is
> player
> but i have a problem because the palletes are mixed up and the colors are
> weird.
> its like if it was using only 1 pallete, can anyone help?
Use that:

> static BITMAP *background;
> static PALLETE pal1;
> BITMAP *player;
> PALLETE pal2;
>
> int main ()
> {
>    allegro_init();
   set_color_depth(16);
   if (set_gfx_mode(GFX_AUTODETECT, 800, 600, 0, 0) != 0) {
  printf("Error setting a 16 bpp 800x600 video mode\n%s\n\n",
allegro_error);
  return 1;
      }
 set_color_conversion(COLORCONV_TOTAL);

>    background = load_pcx("background.pcx",pal1);
>    set_pallete(pal1);
>    player = load_pcx("player.pcx",pal2);
>    set_pallete(pal2);
>    blit(background,screen,0,0,0,0,800,600);
>    blit(player,background,0,490,j,490,92,99);
>    destroy_bitmap(background);
>    destroy_bitmap(player);
>    allegro_exit();
> }

or change resolution -- 640x480x16bpp is good enough for majority of apps.

Your problem is a too small display palette. If you want to save this
palette anyway, then you've to define and redefine it manually (like in
Starcraft). But that is a torment. :)


- Raw text -


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