|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: C T
Length: 1801 (0x709) Types: TextFile Names: »Colors.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Tetrix/Colors.c«
/* Tetrix color support by Eric S. Raymond, eric@snark.uu.net */ #include <curses.h> #include "tet.h" #ifdef COLOR /* color pair indexes for pieces */ #define BLACK 0 #define GREEN 1 #define RED 2 #define TAN 3 #define WHITE 4 #define VIOLET 5 #define BLUE 6 #define YELLOW 7 #define NCOLORS 8 static int attribs[NCOLORS]; typedef struct { int forgrnd; int attrib; } colorpair; void init_colors() { start_color(); init_pair(BLACK, COLOR_BLACK, COLOR_BLACK); attribs[BLACK] = COLOR_PAIR(BLACK); init_pair(GREEN, COLOR_GREEN, COLOR_BLACK); attribs[GREEN] = COLOR_PAIR(GREEN); init_pair(RED, COLOR_RED, COLOR_BLACK); attribs[RED] = COLOR_PAIR(RED); #ifdef EGA init_pair(TAN, COLOR_YELLOW, COLOR_BLACK); #else init_pair(TAN, COLOR_CYAN, COLOR_BLACK); #endif /* EGA */ attribs[TAN] = COLOR_PAIR(TAN); init_pair(WHITE, COLOR_WHITE, COLOR_BLACK); attribs[WHITE] = COLOR_PAIR(WHITE); init_pair(VIOLET, COLOR_MAGENTA, COLOR_BLACK); attribs[VIOLET] = COLOR_PAIR(VIOLET); init_pair(BLUE, COLOR_BLUE, COLOR_BLACK); attribs[BLUE] = COLOR_PAIR(BLUE); #ifdef EGA attribs[YELLOW] = attribs[TAN] | A_BOLD; #else init_pair(YELLOW, COLOR_YELLOW, COLOR_BLACK); attribs[YELLOW] = COLOR_PAIR(YELLOW); #endif /* EGA */ } void PUTCH(x,y,z) int x, y, z; { switch(z) { case ' ': attron(attribs[BLACK]); break; case 'G': attron(attribs[GREEN]); break; case 'R': attron(attribs[RED]); break; case 'O': attron(attribs[TAN]); break; case 'W': attron(attribs[WHITE]); break; case 'V': attron(attribs[VIOLET]); break; case 'B': attron(attribs[BLUE]); break; case 'Y': attron(attribs[YELLOW]); break; } mvaddch(y+MINY,x+MINX, z); attrset(0); Board[x][y]=z; } #endif /* COLOR */