CashWorld/tools.cpp

34 lines
754 B
C++
Raw Permalink Normal View History

2018-06-17 12:13:16 +08:00
#include "tools.h"
#include <windows.h>
#include <stdio.h>
void SetWindowSize(int cols, int lines)//<2F><><EFBFBD>ô<EFBFBD><C3B4>ڴ<EFBFBD>С
{
system("title ̰<><CCB0><EFBFBD><EFBFBD> ");//<2F><><EFBFBD>ô<EFBFBD><C3B4>ڱ<EFBFBD><DAB1><EFBFBD>
char cmd[30];
sprintf(cmd, "mode con cols=%d lines=%d", cols * 2, lines);//һ<><D2BB><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>*2
system(cmd);//system(mode con cols=88 lines=88)
}
void SetCursorPosition(const int x, const int y)//
{
COORD position;
position.X = x * 2;
position.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), position);
}
void SetColor(int colorID)//
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), colorID);
}
void SetBackColor()//
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
FOREGROUND_BLUE |
BACKGROUND_BLUE |
BACKGROUND_GREEN |
BACKGROUND_RED);
}