【C语言】超级简单的字符界面

闲来无聊,写了一个小时候看到其他软件经常出现的字符界面。

实现了一定的通用性,字体居中等等;逻辑上没什么难度,本来是C语言写的,由于太过无聊,又改成C++了

#include<iostream>
#include<windows.h>
#include<String.h>
#include<time.h>
#pragma comment(lib,"user32.lib")
using namespace std;

class UI{
		void Pos(int x,int y);
	public:
		void setTime();
		void surface(int x,int y,int start_x ,int start_y,WORD color);
		void Information(int x,int y,string str,string author,string data,int start_x,int start_y,WORD color);
}; 

void UI::Pos(int x, int y){
	COORD pos;
    HANDLE hOutput;
    pos.X = x;
    pos.Y = y;
    hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOutput, pos);
}
void UI::surface(int x,int y,int start_x =0,int start_y =0,WORD color=FOREGROUND_RED){
	CONSOLE_SCREEN_BUFFER_INFO csbi;
	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	GetConsoleScreenBufferInfo(hConsole, &csbi);
	start_x+=csbi.dwCursorPosition.X;
	start_y+=csbi.dwCursorPosit
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值