#include "SurcoucheConsole.h"
Aller au code source de ce fichier.
Fonctions | |
void | ConsoleClear () |
Efface la console. | |
void | ConsoleSetColor (unsigned int iText, unsigned int iFond) |
Change la couleur de la console. | |
void | ConsoleColor (unsigned int iText, unsigned int iFond, unsigned int iX, unsigned int iY, unsigned int iL, unsigned int iH) |
Change la couleur de carracteres. | |
void | ConsoleWrite (char *pData, unsigned int iX, unsigned int iY, unsigned int iL, unsigned int iH) |
Ecrit dans le buffer une zone. |
Définition dans le fichier SurcoucheConsole.cpp.
|
Vide le buffer stdout et efface la console. Définition à la ligne 14 du fichier SurcoucheConsole.cpp. 00015 { 00016 #ifdef WIN32 00017 system("CLS"); 00018 #else 00019 printf("\033[2J\033[0;0H"); 00020 #endif 00021 }
|
|
Définie la couleur de police et de fond d'un certain nombre de carracteres.
Définition à la ligne 34 du fichier SurcoucheConsole.cpp. 00035 { 00036 unsigned int i; 00037 #ifdef WIN32 00038 unsigned int c; 00039 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); 00040 COORD Pos; 00041 WORD *Data; 00042 00043 Pos.X = iX; 00044 Pos.Y = iY; 00045 00046 Data = (WORD *)malloc(sizeof(WORD) * iL); 00047 for(i = 0; i < iL; Data[i++] = iText|iFond); 00048 00049 for(i = iY; i < (iY + iH); i++) 00050 { 00051 Pos.Y = i; 00052 WriteConsoleOutputAttribute(hConsole, Data, iL, Pos, (LPDWORD)c); 00053 } 00054 #else 00055 char *Data; 00056 00057 Data = (char *)malloc(sizeof(char) * iL + 1); 00058 for(i = 0; i < iL; Data[i++] = ' '); 00059 Data[i] = '\0'; 00060 00061 for(i = iY; i < (iY + iH); i++) 00062 { 00063 printf("\033[%d;%dH", iX, i); 00064 printf("\033[0;%d;%dm%s\033[0m", iText, iFond, Data); 00065 } 00066 #endif 00067 free(Data); 00068 }
|
|
Définie la couleur de police et de fond de la console.
Définition à la ligne 23 du fichier SurcoucheConsole.cpp. 00024 { 00025 #ifdef WIN32 00026 HANDLE hconsole = GetStdHandle(STD_OUTPUT_HANDLE); 00027 WORD color = iText|iFond; 00028 SetConsoleTextAttribute(hconsole, color); 00029 #else 00030 printf("\033[0;%d;%dm", iText, iFond); 00031 #endif 00032 }
|
|
Ecrit dans une zone à une position donnée dans la console
Définition à la ligne 70 du fichier SurcoucheConsole.cpp. 00071 { 00072 unsigned int i, j; 00073 char *Data; 00074 char *ptr; 00075 #ifdef WIN32 00076 unsigned int c; 00077 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); 00078 COORD Pos; 00079 00080 Pos.X = iX; 00081 Pos.Y = iY; 00082 #endif 00083 if(!iL) 00084 iL = strlen(pData); 00085 00086 Data = (char *)malloc(sizeof(char) * iL + 1); 00087 ptr = pData; 00088 00089 for(i = iY; (i < (iY + iH)) && ptr; i++) 00090 { 00091 for(j = 0; (j < iL) && ptr; Data[j++] = *ptr++); 00092 Data[j] = '\0'; 00093 #ifdef WIN32 00094 Pos.Y = i; 00095 WriteConsoleOutputCharacter(hConsole, pData, iL, Pos, (LPDWORD)c); 00096 #else 00097 printf("\033[%d;%dH%s", iX, i, Data); 00098 #endif 00099 } 00100 free(Data); 00101 }
|