mconio
Minimal conio para Win32. clrscr(), gotoxy() para Win32 usando a API de console.
Exemplo de uso:
#include <cstdio>
#include <mconio.h>
#include <windows.h>
using namespace mconio;
void border(const char* title)
{
clrscr();
gotoxy(0, 0);
printf("\xDA");
for (int i = 1; i <= 78; ++i) {
gotoxy(i, 0);
printf("\xC4");
}
gotoxy(78, 0);
printf("\xBF");
for (int i = 1; i <= 23; ++i) {
gotoxy(0, i);
printf("\xB3");
gotoxy(78, i);
printf("\xB3");
}
gotoxy(0, 23);
printf("\xC0");
for (int i = 1; i <= 78; ++i) {
gotoxy(i, 23);
printf("\xC4");
}
gotoxy(78, 23);
printf("\xD9");
gotoxy(2, 0);
printf("\xB4 %s \xC3", title);
}
int main()
{
set_attribute( WHITE | FOREGROUND_INTENSITY );
border("MCONIO demo");
set_attribute( WHITE | FOREGROUND_INTENSITY | BACKGROUND_RED );
UINT ConsoleCP = GetConsoleOutputCP();
gotoxy(10, 3);
printf("Console codepage: %d", ConsoleCP);
set_attribute( WHITE | FOREGROUND_INTENSITY );
gotoxy(10, 5);
printf("10x5 - White");
set_attribute( MAGENTA| FOREGROUND_INTENSITY );
gotoxy(30, 5);
printf("30x5 - Magenta");
set_attribute( GREEN | FOREGROUND_INTENSITY );
gotoxy(12, 7);
printf("12x7 - Green");
set_attribute( YELLOW | FOREGROUND_INTENSITY );
gotoxy(40, 7);
printf("40x7 - Yellow");
set_attribute( CYAN | FOREGROUND_INTENSITY );
gotoxy(18, 9);
printf("12x5 - Cyan");
set_attribute( WHITE );
gotoxy(1,24);
}
Que exibe:
SHA1(mconio.zip)= bf3d4b15025882f2b76f72eb36cdc5be90c2d25a
home
codeblog
links





|
© 2003-2010 Josué Andrade Gomes |

