#include <string.h>
#include <stdio.h>
#include <stdlib.h>
Aller au code source de ce fichier.
Macros | |
| #define | COLOR_F_NOIR 30 |
| #define | COLOR_F_BLEU 34 |
| #define | COLOR_F_VERT 32 |
| #define | COLOR_F_CYAN 36 |
| #define | COLOR_F_ROUGE 31 |
| #define | COLOR_F_ROSE 35 |
| #define | COLOR_F_JAUNE 33 |
| #define | COLOR_F_BLANC 37 |
| #define | COLOR_B_NOIR 40 |
| #define | COLOR_B_BLEU 44 |
| #define | COLOR_B_VERT 42 |
| #define | COLOR_B_CYAN 46 |
| #define | COLOR_B_ROUGE 41 |
| #define | COLOR_B_ROSE 45 |
| #define | COLOR_B_JAUNE 43 |
| #define | COLOR_B_BLANC 47 |
Fonctions | |
| void | ConsoleClear () |
| Efface la console. | |
| void | ConsoleSetColor (unsigned int iText, unsigned int iFond=COLOR_B_NOIR) |
| 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=1) |
| Change la couleur de carracteres. | |
| void | ConsoleWrite (char *pData, unsigned int iX, unsigned int iY, unsigned int iL=0, unsigned int iH=1) |
| Ecrit dans le buffer une zone. | |
Définition dans le fichier SurcoucheConsole.h.
|
|
fond blanc Définition à la ligne 65 du fichier SurcoucheConsole.h. |
|
|
fond bleu foncé Définition à la ligne 59 du fichier SurcoucheConsole.h. |
|
|
fond cyan Définition à la ligne 61 du fichier SurcoucheConsole.h. |
|
|
fond jaune Définition à la ligne 64 du fichier SurcoucheConsole.h. |
|
|
fond noir Définition à la ligne 58 du fichier SurcoucheConsole.h. |
|
|
fond rose Définition à la ligne 63 du fichier SurcoucheConsole.h. |
|
|
fond rouge Définition à la ligne 62 du fichier SurcoucheConsole.h. |
|
|
fond vert foncé Définition à la ligne 60 du fichier SurcoucheConsole.h. |
|
|
police blanc Définition à la ligne 56 du fichier SurcoucheConsole.h. |
|
|
police bleu foncé Définition à la ligne 50 du fichier SurcoucheConsole.h. |
|
|
police cyan Définition à la ligne 52 du fichier SurcoucheConsole.h. |
|
|
police jaune Définition à la ligne 55 du fichier SurcoucheConsole.h. |
|
|
police noir Définition à la ligne 49 du fichier SurcoucheConsole.h. |
|
|
police rose Définition à la ligne 54 du fichier SurcoucheConsole.h. |
|
|
police rouge Définition à la ligne 53 du fichier SurcoucheConsole.h. |
|
|
police vert foncé Définition à la ligne 51 du fichier SurcoucheConsole.h. |
|
|
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 }
|
1.3.9.1