www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/01/14:51:01

Xref: news2.mv.net comp.os.msdos.djgpp:4440
From: Shawn Hargreaves <slh100 AT york DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Mixing two palettes with allegro
Date: Fri, 31 May 1996 11:24:24 +0100
Organization: The University of York, UK
Lines: 47
Message-ID: <Pine.SGI.3.91.960531103746.1178A-100000@sgi2.york.ac.uk>
NNTP-Posting-Host: sgi2.york.ac.uk
Mime-Version: 1.0
In-Reply-To: <4ojrcc$36t@groa.uct.ac.za>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 30 May 1996, David Nunez wrote:

> I want to make a picture viewer, with a nice gui like set of controls. 
> I want to setthe first 128 colours of my palette (working with 
> 320x200x256) to those of the pic I load in, and the other 128 I want 
> to use for my gui and other stuff. I tried making a RGB pal[256] and 
> the a for loop that copied first the 128 colours of my pic to the 
> first 128 of pal, and then copied the 128 of the gui to the last 128 
> of pal using a simple
>
> 	for (int k = 0; k < 128; k++)  //no typos -- new editor(sorry)+
> 	pal[k] = pic_palette[k];
> 
> 	for (int k = 128; k < 256; k++)
> 	pal[k] = gui_palette[k-128]; //i
> 
> All this gave me was a really wierd set of palette type animation on 
> the screen All the colours went crazy, changing all the time. Then 
> when it was all over, the colours were all screwed up. Any suggestions?

Your approach looks fine to me. I don't understand how you could be 
getting an animation type effect, unless you are setting the pallete 
repeatedly with different values. If you just have the one call to 
set_pallete(pal) after that snippet of code, there is no way it could 
result in color cycling...

If you mail me a larger chunk of your code, I'd be happy to take a look 
at it and see if I can locate the problem.

The other problem you will encouter, though (pretty obvious, really) is 
that you won't be able to display pictures using colors 128-256. You will 
have to do some color reduction to convert the images so they don't use 
the colors you have reserved for your interface...

> (PS. to make a pointer which uses colours say 127&128 instread of the 
> default colours, do I just define my own custom pointer?)

Yes. You can use any bitmap as a mouse pointer, by calling 
set_mouse_sprite(bitmap).


/*
 *	Shawn Hargreaves.        Why is 'phonetic' spelt with a ph?
 *	Check out Allegro and FED on http://www.york.ac.uk/~slh100/
 */


- Raw text -


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