ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/08/23/06:13:47

Date: Mon, 23 Aug 93 11:34:32 +0200
From: pi92ae AT pt DOT hk-r DOT se (Andy addIRCt Eskilsson)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Hmm speedy graphics

I made my first "palette scroll" routine. Waa fun.. I didn't realize
it was so fun programming graphics :)
Well compiled it.. run it.. and.. and.. 
Well I guess I have hit this problem with screen refresh rates and so
on?
The screen flickered.. and it was a funny effect but not what I
wanted.. looked kindof weird.. Well how do I fix this.. what the
program did was :
Draw lines in 256 colors.. then reassign all the colors so I got a
smooth palette.. and then "rotate" the palette ... so the last color
became the first.. and the first color the second and so on.. 
How do I fix this?
I include the code.. below.
	/andy
p.s. well honestly I guess this question belongs some other place..
but I just wanted to give you folks a try.. so I know that the
solution works with djgpp.
--------------------------------------------------------------------------
  Bill Gates should limit his salary to the  | PI92AE AT pt DOT hk-r DOT se is:
  number of bytes addressable by the latest  |     Andy Eskilsson
  version of MS-DOS, and be taxed based on   |    Tranbaersv. 25:12
  the number of bytes of RAM needed by the   |    s-372 38 Ronneby
  latest version of MS-Windows               |         SWEDEN
--------------------------------------------------------------------------
#include <grx.h>
#include <iostream.h>
#include <std.h>

struct lista   // a linked list.. (going circular.)
{
	int r,g,b;
	lista *next;
};

int main(void)
{
	int col1, col2, col3;
	lista *test, *runner;
	char color=1;

	GrSetMode(GR_biggest_graphics);
	for(col1=1;col1<256;col1++)
	{
		GrLine(col1*2, 0, col1*2, GrMaxY(), col1);
		GrLine(col1*2+1, 0, col1*2+1, GrMaxY(), col1);
	}

	for(col1=1;col1<256;col1++)
	{
	 	lista *temp;
		temp=new lista;
		temp->r=col1;
		temp->g=256-col1;
		temp->b=0;
		temp->next=runner;
		runner=temp;
	}
	for(col1=1;col1<256;col1++)
	{
	 	lista *temp;
		temp=new lista;
		temp->r=0;
		temp->g=col1;
		temp->b=256-col1;
		temp->next=runner;
		runner=temp;
	}
	test=runner;
	while(test->next!=0)
		test=test->next;
	test->next=runner;

	while(1)
	{
		GrSetColor(color++, runner->r, runner->g, runner->b);
		for(col1=0;col1<100;col1++);
		runner=runner->next;
								  		
	}
	cin >> col3;					
	GrSetMode(GR_80_25_text);
}
		

- Raw text -


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