long _setbkcolor(long pixel) { long prev = _getbkcolor(); CONSOLE_SCREEN_BUFFER_INFO record; WORD attrib; GetConsoleScreenBufferInfo(STDCONSOLE, &record); attrib = record.wAttributes; attrib -= (attrib & color_to_WORD(_BRIGHTWHITE, 1)); attrib |= color_to_WORD(pixel, 1); SetConsoleTextAttribute(STDCONSOLE, attrib); return prev; }
void main( int argc, char **argv ) { #if MS_CMDS struct videoconfig vc; short videomode; /* Save original foreground, background, and text position. */ _getvideoconfig( &vc ); oldfgd = _gettextcolor(); oldbgd = _getbkcolor(); if ( vc.mode != _TEXTC80 ) { if ( _setvideomode( _TEXTC80 ) == 0 ) { _getvideoconfig( &vc ); prn_xprintf( stderr, "Failed to set color video mode\n" ); } else { reset_mode = FALSE; } } else { reset_mode = FALSE; } #endif /* MS_CMDS */ bwb_init( argc, argv ); #if INTERACTIVE setjmp( mark ); #endif /* now set the number of colors available */ * var_findnval( co, co->array_pos ) = (bnumber) vc.numcolors; /* main program loop */ while( !feof( stdin ) ) /* condition !feof( stdin ) added in v1.11 */ { bwb_mainloop(); } }
void Ausg_Punkt_Inv(char nr,char maxbr,char *basisadr,char x,char y) { char memstr[40]; short oldtxtcol=_gettextcolor(); long oldbkcol =_getbkcolor(); _settextposition(y,x); strcpy(memstr,basisadr+nr*maxbr); _settextcolor((short)oldbkcol); /*0*/ _setbkcolor((long)oldtxtcol); /*15*/ /* TM_Prot(); */ _outtext(memstr); /* TM_Prot(); */ _settextcolor(oldtxtcol); _setbkcolor(oldbkcol); }