ksp:c: add ANSI colors

also properly show thrust/no-thrust
This commit is contained in:
Vince Weaver 2016-06-11 22:50:21 -04:00
parent e5a424a688
commit 81ce88af1d

View File

@ -69,70 +69,110 @@ static void draw_ship(int stage, int thrusting, int rotation) {
if (rotation==0) {
printf("\033[1;40;37m"
"\033[7;40H_"
"\033[8;39H/O\\"
"\033[8;39H/\033[36mo\033[37m\\"
"\033[9;38H/___\\"
"\033[10;38H| R |"
"\033[10;38H| \033[41m \033[40m |"
"\033[11;38H|___|"
"\033[12;39H/_\\");
if (thrusting) printf("\033[13;39H\\|/");
"\033[12;39H\033[36m/_\\\033[37m");
if (thrusting) {
printf("\033[13;39H\033[33m\\\033[31m|\033[33m/\033[37m");
}
}
if (rotation==8) {
printf(
"\033[1;40;37m"
"\033[7;42H_"
"\033[8;41H/\\o\\"
"\033[9;40H/ R\\|"
"\033[8;41H/\\\033[36mo\033[37m\\"
"\033[9;40H/ \033[41m \033[40m\\|"
"\033[10;39H/ /"
"\033[11;38H_\\ /"
"\033[12;37H/\\/\\/"
"\033[13;37H--"
"\033[11;38H\033[36m_\033[37m\\ /"
);
if (thrusting) {
printf(
"\033[12;37H\033[33m/\033[36m\\/\033[37m\\/"
"\033[13;37H\033[33m--\033[37m");
}
else {
printf(
"\033[12;37H \033[36m\\/\033[37m\\/");
}
}
if (rotation==16) {
printf("\033[1;40;37m");
printf(
"\033[8;36H_ ____ _"
"\033[9;34H-| -| | \\"
"\033[10;33H--| | R| O|"
"\033[11;34H-|_-|____|_/"
if (thrusting) {
printf(
"\033[8;36H\033[36m_ \033[37m____ _"
"\033[9;34H\033[33m-\033[36m| -\033[37m| | \\"
"\033[10;33H\033[33m-\033[31m-\033[36m| \033[37m| \033[41m \033[40m| \033[36mo\033[37m|"
"\033[11;34H\033[33m-\033[36m|_-\033[37m|____|_/"
);
}
else {
printf(
"\033[8;36H\033[36m_ \033[37m ____ _"
"\033[9;34H \033[36m| -\033[37m| | \\"
"\033[10;33H \033[36m| \033[37m| \033[41m \033[40m| \033[36mo\033[37m|"
"\033[11;34H \033[36m|_-\033[37m|____|_/"
);
}
}
if (rotation==24) {
printf("\033[1;40;37m");
if (thrusting) {
printf(
"\033[7;38H\033[33m__\033[37m"
"\033[8;38H\033[33m\\\033[36m/|\033[37m/\\"
);
}
else {
printf(
"\033[8;38H \033[36m/|\033[37m/\\"
);
}
printf(
"\033[1;40;37m"
"\033[7;38H__"
"\033[8;38H\\/|/\\"
"\033[9;38H'-/ \\"
"\033[9;38H\033[36m'-\033[37m/ \\"
"\033[10;40H\\ \\"
"\033[11;41H\\ R/|"
"\033[12;42H\\/o/"
"\033[11;41H\\ \033[41m \033[40m/|"
"\033[12;42H\\/\033[36mo\033[37m/"
"\033[13;43H-/"
);
}
if (rotation==32) {
if (thrusting) printf("\033[7;39H/|\\");
printf("\033[1;40;37m");
if (thrusting) {
printf("\033[7;39H\033[33m/\033[31m|\033[33m\\");
}
printf(
"\033[1;40;37m"
"\033[8;39H\\-/"
"\033[8;39H\033[36m\\-/\033[37m"
"\033[9;38H| |"
"\033[10;38H| R |"
"\033[10;38H| \033[41m \033[40m |"
"\033[11;38H\\---/"
"\033[12;39H\\O/"
"\033[7;40H-"
"\033[12;39H\\\033[36mo\033[37m/"
"\033[13;40H-"
);
}
if (rotation==40) {
printf("\033[1;40;37m");
if (thrusting) {
printf(
"\033[7;44H\033[33m__\033[37m"
"\033[8;41H/\\\033[36m|\\\033[33m/\033[36m"
);
}
else {
printf(
"\033[8;41H/\\\033[36m|\\\033[37m"
);
}
printf(
"\033[1;40;37m"
"\033[7;44H__"
"\033[8;41H/\\|\\/"
"\033[9;40H/ \\-'"
"\033[9;40H/ \\\033[36m-'\033[37m"
"\033[10;39H/ /"
"\033[11;38H|\\R /"
"\033[12;38H\\o\\/"
"\033[11;38H|\\\033[41m \033[40m /"
"\033[12;38H\\\033[36mo\033[37m\\/"
"\033[13;39H\\-"
);
}
@ -141,18 +181,18 @@ static void draw_ship(int stage, int thrusting, int rotation) {
printf("\033[1;40;37m");
if (thrusting) {
printf(
"\033[8;35H_ ____ _"
"\033[9;34H/ | |- |-"
"\033[10;33H|O |R | |--"
"\033[11;34H\\_|____|-_|-"
"\033[8;35H_ ____ \033[36m_\033[37m"
"\033[9;34H/ | |\033[36m- |\033[33m-\033[37m"
"\033[10;33H|\033[36mo\033[37m |\033[41m \033[40m | \033[36m|\033[31m-\033[33m-\033[37m"
"\033[11;34H\\_|____|\033[36m-_|\033[33m-\033[37m"
);
}
else {
printf(
"\033[8;35H_ ____ _"
"\033[9;34H/ | |- |"
"\033[10;33H|O |R | |"
"\033[11;34H\\_|____|-_|"
"\033[8;35H_ ____ \033[36m_\033[37m"
"\033[9;34H/ | |\033[36m- |\033[36m"
"\033[10;33H|\033[36mo\033[37m |\033[41m \033[40m | \033[36m|\033[37m"
"\033[11;34H\\_|____|\033[36m-_|\033[37m"
);
}
}
@ -161,13 +201,22 @@ static void draw_ship(int stage, int thrusting, int rotation) {
printf("\033[1;40;37m");
printf(
"\033[7;37H_"
"\033[8;36H/o/\\"
"\033[9;36H|/R \\"
"\033[8;36H/\033[36mo\033[37m/\\"
"\033[9;36H|/\033[41m \033[40m \\"
"\033[10;37H\\ \\"
"\033[11;38H\\ /_"
"\033[12;39H\\/|/\\"
"\033[13;42H--"
"\033[11;38H\\ /\033[36m_\033[37m"
);
if (thrusting) {
printf(
"\033[12;39H\\/\033[36m|/\033[33m\\\033[37m"
"\033[13;42H\033[33m--\033[37m"
);
}
else {
printf(
"\033[12;39H\\/\033[36m|/\033[37m"
);
}
}