我的创作纪念日

机缘

在学习c++的路上,我注册了一个CSDN账号(为了方便),在CSDN中我学会了很多......


收获

提示:在创作的过程中都有哪些收获

例如:

  1. 获得了27粉丝的关注
  2. 获得了2209个正向的反馈,如赞、评论、阅读量等
  3. 认识的志同道合的领域同行:​​​​​C++小盆友

O.M.G 欧子正

脏脏包

Wormwaker

一只贴代码君

留在记忆里的一抹残影


日常

  1. 创作已经是我生活的一部分
  2. 和志同道合的人聊天
  3. 在CSDN上学习

成就

你过去写得最好的一段代码是什么?

cpp 复制代码
#ifndef PRGB_HPP
#define PRGB_HPP

#ifndef PB_HPP
#define PB_HPP

/*头文件*/
#include<string>
#include<fstream>
#include<sstream>
#include<stdio.h>

/*PD库*/
#define PDAPI
namespace PD{
	class{
		public:
			void what(){
				printf("作者:杨某一辰\n介绍:CSDN博客,主页:https://blog.csdn.net/langhat\n");
				printf("库名:PD\n开始编写时间:2023-9-23\n版本:1.0.0(非正式)\n版本开始编写时间:2023-9-23\n");
			}
	}pdl;
}

/*类型*/
typedef bool PBool;
#define PStr std::string

/*API和类*/
namespace PD{}

#endif
#include<windows.h>
#include<stdio.h>

//s:淡 b:亮
#define BLACK 0
#define BLUE 1
#define GREEN 2
#define SBULE 3
#define RED 4
#define PURPLE 5
#define YELLO 6
#define WHILE 7
#define ASH 8
#define S_EBULE 9
#define BGREEN 10
#define BBULE 11
#define SRED 12
#define SPURPLE 13
#define BYELLO 14
#define BWHILE 15

//SetRGB
//COLOR Max&Min value
#define MAXCOLOR 256
#define MINCOLOR 0

//Neutral color
#define RGB_WHITE 255,255,255
#define RGB_BLACK 0,0,0
#define RGB_GREY 190,190,190
#define RGB_LGREY 211,211,211

//Color:
#define RGB_RED 256,0,0
#define RGB_YELLOW 255,255,0
#define RGB_BULE 0,0,256
#define RGB_GREEN 0,256,0
//More yellow:
#define RGB_YELLOW2 238,238,0
#define RGB_YELLOW3 205,205,0
#define RGB_YELLOW4 139,139,0
//;
//;

#define GetRGBColorHelp() system("start https:\\tool.oschina.net\commons?type=3")

namespace PD{
	
	int SetRGB(int r,int g,int b){
		HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
		if(hOut==INVALID_HANDLE_VALUE)return GetLastError();
		DWORD dwMode=0;
		if(!GetConsoleMode(hOut,&dwMode))return GetLastError();
		dwMode|=0x0004;
		if(!SetConsoleMode(hOut,dwMode))return GetLastError();
		wprintf(L"\x1b[38;2;%d;%d;%dm",r,g,b);
		return 0;
	}
	
	void SetColor(int fore,int back){
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),(back<<4)+fore);
	}
	
}

#endif

注:这是我写的一个库的其中的两个文件(Pb.hpp,PRGB.hpp)

代码思路:

用了一些windowsAPI,SetRGB() 是设置颜色(RGB)


憧憬​​​​​​​

憧憬

学会Qt,MFC,Windows程序,但看来还要很久......

相关推荐
踏过山河,踏过海10 个月前
我的创作纪念日
我的创作纪念日