void UI_ApplyCustomColors( void ) { char *afile = (char *)LOAD_FILE( "gfx/shell/colors.lst", NULL ); char *pfile = afile; char token[1024]; if( !afile ) { // not error, not warning, just notify Con_Printf( "UI_SetColors: colors.lst not found\n" ); return; } while(( pfile = COM_ParseFile( pfile, token )) != NULL ) { if( !stricmp( token, "HELP_COLOR" )) { UI_ParseColor( pfile, &uiColorHelp ); } else if( !stricmp( token, "PROMPT_BG_COLOR" )) { UI_ParseColor( pfile, &uiPromptBgColor ); } else if( !stricmp( token, "PROMPT_TEXT_COLOR" )) { UI_ParseColor( pfile, &uiPromptTextColor ); } else if( !stricmp( token, "PROMPT_FOCUS_COLOR" )) { UI_ParseColor( pfile, &uiPromptFocusColor ); } else if( !stricmp( token, "INPUT_TEXT_COLOR" )) { UI_ParseColor( pfile, &uiInputTextColor ); } else if( !stricmp( token, "INPUT_BG_COLOR" )) { UI_ParseColor( pfile, &uiInputBgColor ); } else if( !stricmp( token, "INPUT_FG_COLOR" )) { UI_ParseColor( pfile, &uiInputFgColor ); } else if( !stricmp( token, "CON_TEXT_COLOR" )) { UI_ParseColor( pfile, &uiColorConsole ); } } int r, g, b; UnpackRGB( r, g, b, uiColorConsole ); ConsoleSetColor( r, g, b ); FREE_FILE( afile ); }
/*----------------------------------------------------------------------------- Console: Extern Functions ---------------------------------------------------------------------------*/ extern void ConsoleFillRect( int top, int left, int bottom, int right, int fgColor, int bgColor, const char* str) { ConsoleSetColor( fgColor, bgColor ); for (int i=top; i<bottom; ++i) { ConsoleSetCursor( i, 0 ); for (int j=left; j<right; ++j) { ConsolePrint(str); } } }
extern void ConsolePrintStrStack(void) { const char *str; int i = 0; while ((str = ConsolePopStrStack()) != NULL) { ConsoleSetColor(WHITE, BLACK); ConsoleSetCursor(i++, 0); ConsolePrint(str); } }
/* 書式付文字列をコンソール画面に出力。 * ラッパ関数:ConsoleSetColor, ConsoleSetCursor, ConsolePrint * * @ret 書き込んだ文字列の長さ。 * @param y 書き込む画面位置Y * @param x 書き込む画面位置X * @param fg 文字列の前景色 * @param bg 文字列の後景色 * @param fmt 書式 */ extern int ConsolePrintFormat(int y, int x, int fg, int bg, const char *fmt, ...) { char str[NUM_MAX_STR] = {}; va_list args; va_start(args, fmt); vsnprintf(str, sizeof(str), fmt, args); va_end(args); ConsoleSetCursor(y, x); ConsoleSetColor(fg, bg); return ConsolePrint(str); }