C++艺术字头文件:ArtText.h

最近写color()写飙了,想搞一个通用的艺术字函数,就媜出来一个ArtText.h。

        名字叫做ArtText.h

#ifndef ART_TEXT_H

#include 
#include 

using namespace std;

HWND hWnd = GetConsoleWindow(); 

#define Art_Windows(bool)  bool ? SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW) : SetWindowLong(NULL, GWL_EXSTYLE, WS_EX_TOOLWINDOW)
#define Art_Title(string)	SetConsoleTitle(string)

void Art_Colour(int colors)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), colors);
}

void Art_Text(string Text, string Behind, const char* Printf, int Wait_Time)
{
	int Behind_Size[16];
	int Behind_Size_Head[16] = {0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240};
	int Behind_Head;
	int Text_Size_Head[16] = {0, 1, 2, 3, 4, 80, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
	int Text_Head;
	if(Behind == "黑色")
		Behind_Head = Behind_Size_Head[0];
	if(Behind == "暗深蓝色")
		Behind_Head = Behind_Size_Head[1];
	if(Behind == "深绿色" || Behind == "暗绿色")
		Behind_Head = Behind_Size_Head[2];
	if(Behind == "暗淡蓝色")
		Behind_Head = Behind_Size_Head[3];
	if(Behind == "暗红色" || Behind == "深红色")
		Behind_Head = Behind_Size_Head[4];
	if(Behind == "暗紫色" || Behind == "深紫色")
		Behind_Head = Behind_Size_Head[5];
	if(Behind == "暗黄色" || Behind == "深黄色")
		Behind_Head = Behind_Size_Head[6];
	if(Behind == "浅灰色")
		Behind_Head = Behind_Size_Head[7];
	if(Behind == "深灰色")
		Behind_Head = Behind_Size_Head[8];
	if(Behind == "深蓝色" || Behind == "浅深蓝色")
		Behind_Head = Behind_Size_Head[9];
	if(Behind == "绿色" || Behind == "浅绿色")
		Behind_Head = Behind_Size_Head[10];
	if(Behind == "蓝色" || Behind == "浅蓝色")
		Behind_Head = Behind_Size_Head[11];
	if(Behind == "红色" || Behind == "浅红色")
		Behind_Head = Behind_Size_Head[12];
	if(Behind == "紫色" || Behind == "浅紫色")
		Behind_Head = Behind_Size_Head[13];
	if(Behind == "黄色" || Behind == "浅黄色")
		Behind_Head = Behind_Size_Head[14];
	if(Behind == "白色" || Behind == "浅白色")
		Behind_Head = Behind_Size_Head[15];
	if(Text == "黑色")
		Text_Head = Text_Size_Head[0];
	if(Text == "暗深蓝色")
		Text_Head = Text_Size_Head[1];
	if(Text == "深绿色" || Text == "暗绿色")
		Text_Head = Text_Size_Head[2];
	if(Text == "暗淡蓝色")
		Text_Head = Text_Size_Head[3];
	if(Text == "暗红色" || Text == "深红色")
		Text_Head = Text_Size_Head[4];
	if(Text == "暗紫色" || Text == "深紫色")
		Text_Head = Text_Size_Head[5];
	if(Text == "暗黄色" || Text == "深黄色")
		Text_Head = Text_Size_Head[6];
	if(Text == "浅灰色")
		Text_Head = Text_Size_Head[7];
	if(Text == "深灰色")
		Text_Head = Text_Size_Head[8];
	if(Text == "深蓝色" || Text == "浅深蓝色")
		Text_Head = Text_Size_Head[9];
	if(Text == "绿色" || Text == "浅绿色")
		Text_Head = Text_Size_Head[10];
	if(Text == "蓝色" || Text == "浅蓝色")
		Text_Head = Text_Size_Head[11];
	if(Text == "红色" || Text == "浅红色")
		Text_Head = Text_Size_Head[12];
	if(Text == "紫色" || Text == "浅紫色")
		Text_Head = Text_Size_Head[13];
	if(Text == "黄色" || Text == "浅黄色")
		Text_Head = Text_Size_Head[14];
	if(Text == "白色" || Text == "浅白色")
		Text_Head = Text_Size_Head[15];
	for(int i = Behind_Head; i <= Behind_Head + 15; i++)
		Behind_Size[i - Behind_Head] = i;
	int Size = Behind_Size[Text_Head];
    while (1)
    {
    	Art_Colour(Size);
        if (*Printf != 0)
        {
        	printf("%c", *Printf++);
        }
        else
        {
            break;
        }
        _sleep(Wait_Time);
        Size++;
    }
}

#endif

Define

Art_Window(判断真假Bool类型)   //如果是真,窗口改变成尖方窗口,否则返回0。

Art_Title(标题名称string类型)   //更改窗口标题。

Void

Art_Colour(色号¹int类型)   //改变颜色

Art_Text(字体颜色string类型(汉字), 背景颜色string类型(汉字), 输出内容string类型, 间隔时间int类型(单位毫秒))


¹色号:

C++艺术字头文件:ArtText.h_第1张图片

你可能感兴趣的:(#C++打包头文件,c++,开发语言)