From 1199cd2ef3e2fc38f7cfdaf24dc1a58ce2c19d25 Mon Sep 17 00:00:00 2001 From: Alnotz Date: Sun, 3 Oct 2021 09:20:01 +0200 Subject: [PATCH] Logotype C++ v2 --- WeBashCLILogo_v2.cpp | 453 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 453 insertions(+) create mode 100644 WeBashCLILogo_v2.cpp diff --git a/WeBashCLILogo_v2.cpp b/WeBashCLILogo_v2.cpp new file mode 100644 index 0000000..6dc97fd --- /dev/null +++ b/WeBashCLILogo_v2.cpp @@ -0,0 +1,453 @@ +/* Logo dynamique WeBash + * Par Alnotz ! + * Version 2.0 (03/10/2021) + */ +/* + _______________________________ + /._____________________. ._. ._.\ + / |_____________________| |_| |_| \ +/___________________________________\ +| | +| _____ _____ | +| / / / / | +| _____/ /____/ /____ | __ __ __ _ ___ +| / / | \ \ / / / / | | \\ +| /____ _____ _____/ | \ \ / / / / | | || | +| / / / / | \ \ / / / / ___ | |__// ___ ___ |__ +| _____/ /____/ /____ | \ \ / /\ / / /___\ | | \\ ___\ / | \ +| / / | \ \/ /\ \/ / | | | || / | `--, | | +| /____ _____ _____/ | \_\/ \_\/ \___/ |_|__// \___| ___/ | | +| / / / / | +| /____/ /____/ | +| | +\ / + \_________________________________/ + */ +/* g++ -Wall -Wextra -c WeBashLogo.cpp && g++ -Wall -Wextra WeBashLogo.o -o WeBashLogo */ +#include //I/O en C++. +#include //Caractères C++. +#include //Non standard en C de GNU pour 'usleep()'. +#include //Non standard en C de GNU pour 'nanousleep()'. +/* En ce qui concerne les dimensions des symboles et lettres. */ +const int LOGO_LIGNES = 19; +const int LOGO_COLONNES = 80; +const int LETTRES_LIGNES = 19; +const int LETTRES_COLONNES = 23; +const int SORTIE_LIGNES = 19; +const int SORTIE_COLONNES = 100; +/* Numéro de version. */ +const auto LOGO_VERSION = std::string("2.0"); +/* Temps de pause (microsecondes). */ +const int TEMPS_L = 800000; +const int TEMPS_C = 200000; +const int TEMPS_TC = 50000; +/* Fonction d'aide. */ +void help_info(char *commName) +{ + std::cout << + "Aide pour " << commName << " :\n\n\ +Commandes : " << commName << " [-h | --help | -v [SYMBOLE] | --verbose [SYMBOLE] | -V | --version] \n\n\ +-h --help\t\tInformation sur les commandes.\n\n\ +-v --verbose\t\tMode bavard pour les essais. Ajouter une valeur\ +SYMBOLE affiche le symbole correspondant.\n\n\ +-V --version\t\tValeur de version.\n\n\ +SYMBOLE\t\tUne des valeurs de 1 à 6 pour les 6 lettres de WeBash\ +ou 0 pour le logo initial ou encore N pour une fenêtre sans croisillon.\n"; +} +/* Le logo seul. */ +char logo0[LOGO_LIGNES][LOGO_COLONNES] = +{ + " _______________________________ \n", + " /._____________________. ._. ._.\\ \n", + " / |_____________________| |_| |_| \\ \n", + "/___________________________________\\\n", + "| |\n", + "|\x1b[0;31;40m _____ _____ \x1b[0m|\n", + "|\x1b[0;31;40m / / / / \x1b[0m|\n", + "|\x1b[0;31;40m _____/ /____/ /____ \x1b[0m|\n", + "|\x1b[0;31;40m / / \x1b[0m|\n", + "|\x1b[0;31;40m /____ _____ _____/ \x1b[0m|\n", + "|\x1b[0;31;40m / / / / \x1b[0m|\n", + "|\x1b[0;31;40m _____/ /____/ /____ \x1b[0m|\n", + "|\x1b[0;31;40m / / \x1b[0m|\n", + "|\x1b[0;31;40m /____ _____ _____/ \x1b[0m|\n", + "|\x1b[0;31;40m / / / / \x1b[0m|\n", + "|\x1b[0;31;40m /____/ /____/ \x1b[0m| \x1b[5;39;40m######\x1b[0;0;0m\n", + "|\x1b[0;31;40m \x1b[0m|\n", + "\\ /\n", + " \\_________________________________/ \n" +}; +/* Le logo vide. */ +char logoN[LOGO_LIGNES][LOGO_COLONNES] = +{ + " _______________________________ \n", + " /._____________________. ._. ._.\\ \n", + " / |_____________________| |_| |_| \\ \n", + "/___________________________________\\\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "| |\n", + "\\ \x1b[5;31;40m#############################\x1b[0m /\n", + " \\_________________________________/ \n" +}; +/* La lettre 'W'. */ +char logo1[LETTRES_LIGNES][LETTRES_COLONNES] = +{ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "__ __ __\n", + "\\ \\ / / / /\n", + " \\ \\ / / / / \n", + " \\ \\ / / / / \n", + " \\ \\ / /\\ / / \n", + " \\ \\/ /\\ \\/ / \n", + " \\_\\/ \\_\\/ \n", + "\n", + "\n", + "\n", + "\n", + "\n" +}; +/* La lettre 'e'. */ +char logo2[LETTRES_LIGNES+4][LETTRES_COLONNES+4] = +{ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "__ __ __\n", + "\\ \\ / / / /\n", + " \\ \\ / / / / \n", + " \\ \\ / / / / ___ \n", + " \\ \\ / /\\ / / /___\\\n", + " \\ \\/ /\\ \\/ / | \n", + " \\_\\/ \\_\\/ \\___/\n", + "\n", + "\n", + "\n", + "\n", + "\n" +}; +/* La lettre 'B'. */ +char logo3[LETTRES_LIGNES][LETTRES_COLONNES] = +{ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " _ ___ \n", + "| | \\\\\n", + "| | ||\n", + "| |__//\n", + "| | \\\\\n", + "| | ||\n", + "|_|__//\n", + "\n", + "\n", + "\n", + "\n", + "\n" +}; +/* La lettre 'a'. */ +char logo4[LETTRES_LIGNES][LETTRES_COLONNES] = +{ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " ___ \n", + " ___\\\n", + "/ |\n", + "\\___|\n", + "\n", + "\n", + "\n", + "\n", + "\n" +}; +/* La lettre 's'. */ +char logo5[LETTRES_LIGNES][LETTRES_COLONNES] = +{ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " ___\n", + "/ \n", + "`--,\n", + "___/\n", + "\n", + "\n", + "\n", + "\n", + "\n" +}; +/* La lettre 'h'. */ +char logo6[LETTRES_LIGNES][LETTRES_COLONNES] = +{ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + " \n", + " \n", + "| \n", + "|__ \n", + "| \\\n", + "| |\n", + "| |\n", + "\n", + "\n", + "\n", + "\n", + "\n" +}; +void essai(int argc, char **argv) +{ + std::cout << "=================\n===== Tests =====\n=================" << "\n"; + std::cout << "Hello C++ world !\n"; + std::cout << "Name : " << argv[0] << "\n"; + std::cout << "Arg. count : " << argc << "\n"; + std::cout << "Argument : "; + if(argc <= 1) + { + std::cout << "Null"; + } + else + { + std::cout << argv[argc-1]; + } + std::cout << "\n"; + auto argument = std::string(argv[argc-1]); + /* Pour vérifier les caractères, ajouter un numéro de 1 à 6. + * La lettre 'N' correspond à une fenêtre vide, le chiffre '0' + * au logo de WeBash. + */ + std::cout << "\t== Symboles ==" << "\n"; + if(argument=="N") + { + for(auto i=0;i 1) + { + if((std::string(argv[1])=="-h") | (std::string(argv[1])=="--help")) + { + help_info(argv[0]); + } + else if((std::string(argv[1])=="-v") | (std::string(argv[1])=="--verbose")) + { + essai(argc, argv); + } + else if((std::string(argv[1])=="-V") | (std::string(argv[1])=="--version")) + { + std::cout << LOGO_VERSION << std::endl; + } + else + { + std::cerr << argv[0] << " : Mauvaise commande. Taper \'"; + std::cerr << argv[0] << " -h\' pour l'aide." << std::endl; + std::exit(EXIT_FAILURE); + } + } + else//Le cas normal où WeBash est animé. + { + std::cerr << "\x07"; + logoAnimation(); + } + return EXIT_SUCCESS; +}