Mail Archives: djgpp/2001/03/17/15:16:44
Message-ID: | <3AB3C404.702291F7@home.com>
|
From: | Paul Michailidis <paulm14 AT home DOT com>
|
X-Mailer: | Mozilla 4.76 [en] (Win98; U)
|
X-Accept-Language: | en
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Pallete Problem!
|
Lines: | 81
|
Date: | Sat, 17 Mar 2001 20:08:10 GMT
|
NNTP-Posting-Host: | 24.112.60.10
|
X-Complaints-To: | abuse AT home DOT net
|
X-Trace: | news4.rdc1.on.home.com 984859690 24.112.60.10 (Sat, 17 Mar 2001 12:08:10 PST)
|
NNTP-Posting-Date: | Sat, 17 Mar 2001 12:08:10 PST
|
Organization: | Excite AT Home - The Leader in Broadband http://home.com/faster
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi Im making some intro screens for my game. Right now I'm working on
the "company" intro screen but I have a colour problem.
I made an image in windows paint. 640 x 480 with 256 colours. The
background consists of a black background with grey lines. I blited that
to the screen. I set the palette and everythings fine.
I then made the logo in a program called DDTitle which has a depth of 24
bits (tried converting to 256 colour, still same problem). Anyway I
converted it to a windows bitmap and it looks good. Now when I try to
blit the logo onto the background the logo's colours are fine but the
background is screwed up. the black turns into blue and the grey turnes
into some colour i forget. The logo's colours are fine. I tried it with
the images using the same palette and again with separate palettes. No
difference. Here's the code
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
#include "allegro.h"
#define MAXX 640
#define MAXY 480
BITMAP *ImgTitle;
BITMAP *ImgBack;
BITMAP *ImgLogo;
PALLETE PalTitle;
int ErrVmode;
int main(int argc, char *argv[])
{
allegro_init();
install_keyboard();
install_timer();
ErrVmode=set_gfx_mode(GFX_AUTODETECT, MAXX, MAXY, 0, 0); // change
autodetect
if (ErrVmode != 0 )
{
printf("Error setting graphics mode\n%s\n", allegro_error);
allegro_exit ();
return 1;
}
ImgBack = load_bitmap("Data\\4-SBack.bmp", PalTitle);
ImgLogo = load_bitmap("Data\\4-SLogo.bmp", PalTitle);
if (!ImgBack||!ImgLogo)
{
printf("Error reading bitmap");
allegro_exit ();
return 1;
}
set_pallete(PalTitle);
ImgTitle=create_bitmap(MAXX, MAXY);
clear(ImgTitle);
do
{
blit(ImgBack, ImgTitle, 0, 0, 0, 0, MAXX, MAXY);
// some work with pixel animation then blitting to ImgBack
blit(ImgTitle, screen, 0, 0, 0, 0, MAXX, MAXY);
} while (!key[KEY_ESC]);
clear_keybuf();
do
{
blit(ImgBack, ImgTitle, 0, 0, 0, 0, ImgBack->w, ImgBack->h);
blit(ImgLogo, ImgTitle, 0, 0, (MAXX/2) - (ImgLogo->w/2), MAXY/4,
ImgLogo->w, ImgLogo->h);
blit(ImgTitle, screen, 0, 0, 0, 0, MAXX, MAXY);
} while (!key[KEY_ESC]);
fade_out(2);
destroy_bitmap(ImgTitle);
allegro_exit();
return 1;
}
Please help guys!!!
Thanks,
Paul M.
- Raw text -