Just a simple sample program of moving the console cursor, in Windows, and printing with colored text or background.
Code:
#include <stdio.h>
#include <windows.h>
#include <wincon.h>
void Gotoxy(int, int);
int main(void) {
int x, y;
char *starlight = "Oh Be a Fine Girl Kiss Me";
char *ilike = "I like blue stars";
for(x = 0, y = 1; x < 41;) {
Gotoxy(x,y);
printf("%s", ilike);
x += strlen(ilike)+1;
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE|BACKGROUND_RED|BACKGROUND_BLUE|BACKGROUND_GREEN);
printf("\n%s\n ", ilike);
for(y = 4, x = 10; y < 18; y+=5) {
Gotoxy(x, y);
printf("%s", starlight);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED|BACKGROUND_RED);
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED|BACKGROUND_BLUE);
printf("\n\n\n%s", starlight);
printf("\n\n");
return 0;
}
void Gotoxy(int x, int y) {
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
//BLUE |GREEN|RED = White or Grey, depending on Intensity
//All combo's are the same as mixing primary colors of light (not paint).