예제 #1
0
파일: GRAPHS.C 프로젝트: rickytan/Snooker
void fire()									/********火焰动画********/
{
	unsigned int x,y,c;
	setmode();
	for (x=1;x<=32;x++)
	{
		setpal(x,    x*2-1, 0,     0    );
		setpal(x+32, 63,    x*2-1, 0    );
		setpal(x+64, 63,    63,    x*2-1);
		setpal(x+96, 63,    63,    63   );
	}

	while(bioskey(1)==0)
	{
		for (x=0;x<320;x+=2)
		{
			for (y=1;y<=202;y+=2)
			{
				c=(point(x,y)+point(x+2,y)+point(x,y+2)+point(x+2,y+2))>>2;
				if (c--)
				{
					poke(0xa000,(y-2)*320+x,(c<<8)+c);
					poke(0xa000,(y-1)*320+x,(c<<8)+c);
				}
			}
		y-=2;
		pset(x,y,random(320));
		}
	}
	getch();
	closemode();
}
예제 #2
0
파일: sdl_vid.c 프로젝트: davecahill/digger
void vgainten(int16_t inten)
{
	if(inten == 1)
		setpal(ipalettes[currpal]);
	else
		setpal(npalettes[currpal]);
}
예제 #3
0
void UpdatePalette() {
    if (game.color_depth > 1)
        invalidate_screen();

    if (!play.fast_forward)  
        setpal();
}
예제 #4
0
/* ***Beim GEM abmelden*** */
void exitGEM(void)
{
 setpal(oldpal);
 v_clsvwk(vhndl);
 rsrc_free();
 appl_exit();
}
예제 #5
0
void init(){
randomize();
red.basecol=0;
green.basecol=64;
blue.basecol=128;
white.basecol=192;
red.color=random(64);
green.color=64+random(64);
blue.color=128+random(64);
white.color=192+random(64);
red.x=random(320);
red.y=random(199);
green.x=random(320);
green.y=random(199);
blue.x=random(320);
blue.y=random(199);
white.x=random(320);
white.y=random(199);
red.dx=1;
red.dy=1;
green.dx=-1;
green.dy=1;
blue.dx=-1;
blue.dy=-1;
white.dx=1;
white.dy=-1;
startgraph();
setpal();
}
예제 #6
0
void init_ascii(void)
{
	long i;
  for (i = 0; i < 768; i++) {

    unsigned char b = font8x8[i];

    unsigned char h = stretch[b >> 4];
    unsigned char l = stretch[b & 0xf];
    wr(0x1000 + (16 * ' ') + (2 * i), h);
    wr(0x1000 + (16 * ' ') + (2 * i) + 1, l);
  }
  for(i = 0x20; i < 0x80; i++) {
    setpal(4 * i + 0, TRANSPARENT);
    setpal(4 * i + 3, RGB(255,255,255));
  }
  fill(RAM_PIC, ' ', 4096);
}
예제 #7
0
파일: main-lsl.c 프로젝트: AmyBSOD/ToME-SX
/*
 * Term hook
 * Initialize a new term
 */
static void term_init_svgalib(term *t)
{
	int vgamode;

	/* Only one term */
	(void) t;

	vga_init();

	/* The palette is 256x3 bytes big (RGB). */
	C_MAKE(pal, 768, byte);

#ifdef USE_GRAPHICS

	/* Hardwire this mode in for now */
	vgamode = G1024x768x256;

	/* Set up the bitmap buffer context */
	gl_setcontextvgavirtual(vgamode);
	buffer = gl_allocatecontext();
	gl_getcontext(buffer);

	/* Load bitmap into virtual screen */
	term_load_bitmap();

#endif /* USE_GRAPHICS */

	/* Hardwire this mode in for now */
	vgamode = G640x480x256;

	/* Set up the physical screen context */
	if (vga_setmode(vgamode) < 0)
	{
		quit("Graphics mode not available!");
	}

	gl_setcontextvga(vgamode);
	screen = gl_allocatecontext();
	gl_getcontext(screen);

	/* Is this needed? */
	gl_enablepageflipping(screen);

	/* Set up palette colors */
	setpal();

	/* Load the character font data */
	initfont();

	/* Color 0 isn't transparent */
	gl_setwritemode(WRITEMODE_OVERWRITE);
}
예제 #8
0
static int crt_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
                         u_int transp)
{
   if (regno > 255)
     return (1);

   setpal(regno, red, green, blue);
   crt_colour_table [regno][0] = red & 0xff;
   crt_colour_table [regno][1] = green & 0xff;
   crt_colour_table [regno][2] = blue & 0xff;
   crt_colour_table [regno][3] = transp;

   return (0);
}
예제 #9
0
파일: sdl_vid.c 프로젝트: davecahill/digger
void vgapal(int16_t pal)
{
	setpal(npalettes[pal]);
	currpal = pal;
}
예제 #10
0
파일: sdl_vid.cpp 프로젝트: z-10/digger
void vgapal(Sint4 pal)
{
	setpal(npalettes[pal]);
	currpal = pal;
}
예제 #11
0
/* *** Beim GEM anmelden *** */
int initGEM(void)
{
 int rgb[3];
 int work_in[12], work_out[57];		/* VDI-Felder */
 int i, ap_id;

 ap_id=appl_init();
 if(ap_id==-1)	return(-1);
 if(aesversion>=0x400)					/* Wenn m�glich einen Namen anmelden */
	menu_register(ap_id, "  STed\0\0\0\0");
 graf_mouse(ARROW, 0L);					/* Maus als Pfeil */

 if( !rsrc_load("sted.rsc") )
  {
   form_alert(1, "[3][Could not|load <sted.rsc>][Cancel]");
   appl_exit();
   return(-1);
  }
 rsrc_gaddr(R_TREE, MAINMENU, &menu);	/* Adresse holen */
 rsrc_gaddr(R_TREE, ABOUTSED, &aboutdlg);
 rsrc_gaddr(R_TREE, LDATDIA, &lvdatdlg);

#ifdef RESTRIC_STED
 lvdatdlg[LVLTYP].ob_flags |= HIDETREE;
 lvdatdlg[LVLTYP].ob_flags &= ~EDITABLE;
 lvdatdlg[LVLTYPT1].ob_flags |= HIDETREE;
 lvdatdlg[LVLTYPT2].ob_flags |= HIDETREE;
 lvdatdlg[LVLID].ob_flags |= HIDETREE;
 lvdatdlg[LVLID].ob_flags &= ~EDITABLE;
 lvdatdlg[LVLIDT1].ob_flags |= HIDETREE;
#endif

 wind_get(0, WF_WORKXYWH, &deskx, &desky, &deskw, &deskh); /* Desktopgr��e */

 vhndl=graf_handle(&i, &i, &i, &i);
 for(i=0; i<10; i++)	work_in[i]=1;
 work_in[10]=2;
 v_opnvwk(work_in, &vhndl, work_out);	/* VDI-Station �ffnen */

 vq_extnd(vhndl, 1, work_out);
 bipp=work_out[4];						/* Bits pro Bitplane ermitteln */
 if(bipp>8)
  {
   form_alert(1, "[3][Sorry, STed only works|in 16 and 256 colors!][Ok]");
   v_clsvwk(vhndl); rsrc_free(); appl_exit();
   return(-1);
  }

 menu_bar(menu, 1);			/* Men� darstellen */

 for(i=0; i<15; i++)		/* Alte Farben sichern */
  {
   vq_color(vhndl, i, 1, rgb);
   oldpal[i][0]=rgb[0];
   oldpal[i][1]=rgb[1];
   oldpal[i][2]=rgb[2];
  }
 setpal(newpal);			/* Neue Farben setzen */

 return(0);
}
예제 #12
0
파일: TUBE.CPP 프로젝트: mjpearson/algo.vga
void main()
{   
	unsigned char _far *vidmem = (unsigned char _far *)0xA0000000;
	int i, Y_tmp, X_tmp, k, Randnum,tmp;
	int Num_Active			= 0;
	int dz					= Def_DZ;
	unsigned Tube_Xr		= 60;
	unsigned Tube_Yr		= 60;
	unsigned X_org			= 160;
	unsigned Y_org			= 100;
	unsigned X_choice		= 0;
	unsigned Y_choice		= 0;
	unsigned char X_count	= 64;
	unsigned char Y_count	= 0;
	unsigned char D_tube_xr = 64;
	unsigned char D_tube_yr = 0;
	unsigned char count		= 0;
	char quit				= 0;
	
	for(i=0; i < Max_Rand; i++){
		Xtable[i] = (int)(128 * cos(i * PI2 / Max_Rand) + .5); 
		Ytable[i] = (int)(128 * sin(i * PI2 / Max_Rand) + .5);
			
		Index[i]=i;
	}
	
	srand((unsigned)time(NULL));
	for(k=0; k < Max_Rand/2; k++)
		for(i=0; i < Max_Rand; i++){
			Randnum = rand() % Max_Rand;
			tmp = Index[Randnum];
			Index[Randnum] = Index[i];
			Index[i] = tmp;
		}
			
		
	setmode13();
	setpal();
				
	while(!quit){
	
		// Fill in the Field.
		for(k=0; k < Step; k++)
			if(Num_Active < Max_Active){
				for(i=0; star[i].z; i++);
				star[i].x = Tube_Xr * Xtable[Index[X_choice]];
				star[i].y = Tube_Yr * Ytable[Index[Y_choice]];
				star[i].z = Max_Z;
				star[i].xc = 160 + (120 * Xtable[X_count]) / Max_Rand;
				star[i].yc = 100 + (80 * Ytable[Y_count]) / Max_Rand;
				
				if(++X_choice > Max_Rand)
					X_choice = 0;
				if(++Y_choice > Max_Rand)
					Y_choice = 0;
				
				Num_Active++;
			}else
				break;	// No need to loop anymore.
			
		for(i=0; i < Max_Active; i++){
			// If the Star is Active.
			if(star[i].z){
				// Erase the old star.
				*(vidmem + star[i].Old_pos) = 0;
			 	
 				if(star[i].z > Min_Z){
					// Calculate the new one.
					X_tmp = star[i].x / star[i].z + star[i].xc;
				
					// If x lies within boundaries.
					if(X_tmp < 320 && X_tmp > 0){
						Y_tmp = star[i].y / star[i].z + star[i].yc;
					
						//if y lies within boundaries.
						if(Y_tmp < 200 && Y_tmp > 0){
							star[i].Old_pos = X_tmp + Y_tmp * 320;
							*(vidmem + star[i].Old_pos) = star[i].z >> 3;
							star[i].z -= dz;
						}else{
							star[i].z = 0;
							Num_Active--;
						}
					}else{