간단히 API를 이용하면 됩니다ㅋㅋㅋ
/**********예시 코드 ( C언어 )***********/
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
/*
* 콘솔의 글자와 배경 색을 변경해주는 함수.
*/
void setColor ( int Color ) {
SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ) , Color );
}
/*
* 창의 크기를 변경하는 함수.
*/
void setConSize ( int row, int col ) {
char buf[256] = {0};
sprintf ( buf, "mode con: lines=%d cols=%d", row, col );
system ( buf );
}
/*
* 커서의 위치를 X,Y로 옮겨주는 함수.
*/
void gotoXY ( int x, int y ) {
COORD pos = { x, y };
SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ) , pos );
}
/*
* 커서를 보일지 보이지 않을지 결정하는 함수.
*/
void setCursorview ( char visible ) {
CONSOLE_CURSOR_INFO cursor = { 1, visible };
SetConsoleCursorInfo( GetStdHandle ( STD_OUTPUT_HANDLE ) , &cursor );
}
참고 색상표 ( -1은 없는 색, 그냥 자리를 맞추기 위해 넣었습니다 )
