Compare commits
	
		
			No commits in common. "e404159cbe657597c741723d786608ea9cf6ee3c" and "d38b65d59b395508ebf8422f2085c4779ac9ede4" have entirely different histories.
		
	
	
		
			e404159cbe
			...
			d38b65d59b
		
	
		
							
								
								
									
										148
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										148
									
								
								src/main.c
									
									
									
									
									
								
							| @ -1,23 +1,6 @@ | |||||||
| /*
 |  | ||||||
| Photonics helper main programm |  | ||||||
| Das main programm startet die sub programme der verschienene gruppen |  | ||||||
| 
 |  | ||||||
| Autor: Noah Balsinger, Thomas Zwicker |  | ||||||
| Version: 0.1 |  | ||||||
| Datum: 04.12.2024 |  | ||||||
| Änderungen: |  | ||||||
| 0.1 04.12.2024 Dokument erstellt |  | ||||||
| 0.2 09.12.2024 Willkommensnachricht |  | ||||||
| 0.3 10.12.2024 Meun hinzugefügt |  | ||||||
| 0.4 11.12.2024 pipes + easter eggs hinzugefügt |  | ||||||
| 0.5 12.12.2024 Windows version fix |  | ||||||
| 0.6 13.12.2024 Pfeiltasten wurden hinzugefügt |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <stdbool.h> | #include <stdbool.h> | ||||||
| #include <string.h> |  | ||||||
| #include <time.h> | #include <time.h> | ||||||
| 
 | 
 | ||||||
| #ifdef __linux__ | #ifdef __linux__ | ||||||
| @ -34,10 +17,22 @@ Datum: 04.12.2024 | |||||||
| #include "Ramen_Physik.h" | #include "Ramen_Physik.h" | ||||||
| #include "test_prog.h" | #include "test_prog.h" | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  | Photonics helper main programm | ||||||
|  | Das main programm startet die sub programme der verschienene gruppen | ||||||
|  | 
 | ||||||
|  | Autor: Noah Balsinger, Thomas Zwicker | ||||||
|  | Version: 0.1 | ||||||
|  | Datum: 04.12.2024 | ||||||
|  | Änderungen: | ||||||
|  | 0.1 04.12.2024 Dokument erstellt | ||||||
|  | 0.2 09.12.2024 Willkommensnachricht | ||||||
|  | 0.3 10.12.2024 Meun hinzugefügt | ||||||
|  | 0.4 11.12.2024 pipes + easter eggs hinzugefügt | ||||||
|  | */ | ||||||
| 
 | 
 | ||||||
| #ifdef __linux__ | #ifdef __linux__ | ||||||
| int getch(){  | int getch(){  | ||||||
|     // getch funktion für linux (für windows in der conio.h lib)
 |  | ||||||
|     int ch; |     int ch; | ||||||
|     struct termios oldattr, newattr; |     struct termios oldattr, newattr; | ||||||
| 
 | 
 | ||||||
| @ -63,6 +58,7 @@ void get_terminal_size_linux(int argc, char **argv, int *width, int *height){ | |||||||
|     *height = w.ws_row; |     *height = w.ws_row; | ||||||
|     *width = w.ws_col; |     *width = w.ws_col; | ||||||
| } | } | ||||||
|  | 
 | ||||||
| #elif _WIN32 | #elif _WIN32 | ||||||
| void get_terminal_size_windows(int argc, char **argv, int *width, int *height){ | void get_terminal_size_windows(int argc, char **argv, int *width, int *height){ | ||||||
|     CONSOLE_SCREEN_BUFFER_INFO csbi; |     CONSOLE_SCREEN_BUFFER_INFO csbi; | ||||||
| @ -75,28 +71,30 @@ void get_terminal_size_windows(int argc, char **argv, int *width, int *height){ | |||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| void print_line(char line[100], int spaces, char color[5]){ | void print_line(char line[100], int spaces, char color[5]){ | ||||||
|     // funktion welche den text in einer farbe und mit space printet
 |  | ||||||
|     for(int i = 0; i < spaces; i++){ |     for(int i = 0; i < spaces; i++){ | ||||||
|         printf(" "); |         printf(" "); | ||||||
|     } |     } | ||||||
|     printf("\033[1%sm %s \033[0m\n", color, line); |     printf("\033[1%sm %s \033[0m\n", color, line); | ||||||
|  |     // printf("%s\n", line);
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void clear_terminal(){ | void clear_terminal(){ | ||||||
|     printf("\e[1;1H\e[2J"); |     #ifdef __linux__ | ||||||
|  |         printf("\e[1;1H\e[2J"); | ||||||
|  |     #elif _WIN32 | ||||||
|  |         system("cls"); | ||||||
|  |     #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void sleep_universal(int t){ | void sleep_universal(int t){ | ||||||
|     #ifdef __linux__ |     #ifdef __linux__ | ||||||
|         sleep(t); |         sleep(t); | ||||||
|     #elif _WIN32 |     #elif _WIN32 | ||||||
|         // Sleep ist in Milisekunden
 |  | ||||||
|         Sleep(t * 1000); |         Sleep(t * 1000); | ||||||
|     #endif |     #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void print_blank_lines(int lines){ | void print_blank_lines(int lines){ | ||||||
|     // funktion die leere zeilen printet
 |  | ||||||
|     for(int i = 0; i < lines; i++){ |     for(int i = 0; i < lines; i++){ | ||||||
|         printf("\n"); |         printf("\n"); | ||||||
|     } |     } | ||||||
| @ -121,6 +119,20 @@ void print_wellcome(int terminal_width, int terminal_height){ | |||||||
|     print_line("|_|   |_| |_|\\___/ \\__|_| |_|\\___/|_| |_|_|\\___|___/   |_| |_|\\___|_|_|  \\___|_|     ", spaces, ";37"); |     print_line("|_|   |_| |_|\\___/ \\__|_| |_|\\___/|_| |_|_|\\___|___/   |_| |_|\\___|_|_|  \\___|_|     ", spaces, ";37"); | ||||||
| 
 | 
 | ||||||
|     sleep_universal(2); |     sleep_universal(2); | ||||||
|  | 
 | ||||||
|  |     /*
 | ||||||
|  |     printf("__        ___ _ _ _                                                                "); | ||||||
|  |     printf("\ \      / (_) | | | _____  _ __ ___  _ __ ___   ___ _ __      _____   _ _ __ ___  "); | ||||||
|  |     printf(" \ \ /\ / /| | | | |/ / _ \| '_ ` _ \| '_ ` _ \ / _ \ '_ \    |_  / | | | '_ ` _ \ "); | ||||||
|  |     printf("  \ V  V / | | | |   < (_) | | | | | | | | | | |  __/ | | |    / /| |_| | | | | | |"); | ||||||
|  |     printf("   \_/\_/  |_|_|_|_|\_\___/|_| |_| |_|_| |_| |_|\___|_| |_|   /___|\__,_|_| |_| |_|"); | ||||||
|  |     printf("                                                                                   "); | ||||||
|  |     printf(" ____  _           _   _                 _              _   _      _  __           "); | ||||||
|  |     printf("|  _ \| |__   ___ | |_| |__   ___  _ __ (_) ___ ___    | | | | ___| |/ _| ___ _ __ "); | ||||||
|  |     printf("| |_) | '_ \ / _ \| __| '_ \ / _ \| '_ \| |/ __/ __|   | |_| |/ _ \ | |_ / _ \ '__|"); | ||||||
|  |     printf("|  __/| | | | (_) | |_| | | | (_) | | | | | (__\__ \   |  _  |  __/ |  _|  __/ |   "); | ||||||
|  |     printf("|_|   |_| |_|\___/ \__|_| |_|\___/|_| |_|_|\___|___/   |_| |_|\___|_|_|  \___|_|   "); | ||||||
|  |     */ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void print_game_over(int terminal_width, int terminal_height){ | void print_game_over(int terminal_width, int terminal_height){ | ||||||
| @ -137,6 +149,8 @@ void print_game_over(int terminal_width, int terminal_height){ | |||||||
|     print_blank_lines(2); |     print_blank_lines(2); | ||||||
|     print_line("Press a key to contine: ", spaces, ";37"); |     print_line("Press a key to contine: ", spaces, ";37"); | ||||||
|     char key_input = (char)getch(); |     char key_input = (char)getch(); | ||||||
|  |     // getchar();
 | ||||||
|  | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void print_speedrun(int terminal_width, int terminal_height, int speed_time){ | void print_speedrun(int terminal_width, int terminal_height, int speed_time){ | ||||||
| @ -144,6 +158,7 @@ void print_speedrun(int terminal_width, int terminal_height, int speed_time){ | |||||||
|     print_blank_lines((terminal_height - 12) / 2); |     print_blank_lines((terminal_height - 12) / 2); | ||||||
|     int spaces = (terminal_width - 70) / 2; |     int spaces = (terminal_width - 70) / 2; | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     print_line("    _    ____ _   _ ___ _______     _______ __  __ _____ _   _ _____        ", spaces, ";37"); |     print_line("    _    ____ _   _ ___ _______     _______ __  __ _____ _   _ _____        ", spaces, ";37"); | ||||||
|     print_line("   / \\  / ___| | | |_ _| ____\\ \\   / / ____|  \\/  | ____| \\ | |_   _|  ", spaces, ";37"); |     print_line("   / \\  / ___| | | |_ _| ____\\ \\   / / ____|  \\/  | ____| \\ | |_   _|  ", spaces, ";37"); | ||||||
|     print_line("  / _ \\| |   | |_| || ||  _|  \\ \\ / /|  _| | |\\/| |  _| |  \\| | | |(_) ", spaces, ";37"); |     print_line("  / _ \\| |   | |_| || ||  _|  \\ \\ / /|  _| | |\\/| |  _| |  \\| | | |(_) ", spaces, ";37"); | ||||||
| @ -160,6 +175,7 @@ void print_speedrun(int terminal_width, int terminal_height, int speed_time){ | |||||||
|     print_line("", spaces, ";37"); |     print_line("", spaces, ";37"); | ||||||
|     printf("Du brauchtest: %i Sekunden.", speed_time); |     printf("Du brauchtest: %i Sekunden.", speed_time); | ||||||
|     char key_input = (char)getch(); |     char key_input = (char)getch(); | ||||||
|  | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void print_menu(int terminal_width, int terminal_height, int line){ | void print_menu(int terminal_width, int terminal_height, int line){ | ||||||
| @ -169,23 +185,23 @@ void print_menu(int terminal_width, int terminal_height, int line){ | |||||||
|     int spaces = (terminal_width - 41) / 2; |     int spaces = (terminal_width - 41) / 2; | ||||||
| 
 | 
 | ||||||
|         print_line("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓", spaces, (0 <= line && line < 1) ? ";31": ";37"); |         print_line("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓", spaces, (0 <= line && line < 1) ? ";31": ";37"); | ||||||
|         print_line("┃  1 Ramen Physik                       ┃", spaces, (0 <= line && line < 1) ? ";31": ";37"); |         print_line("┃  Ramen Physik                         ┃", spaces, (0 <= line && line < 1) ? ";31": ";37"); | ||||||
|         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (0 <= line && line < 2) ? ";31": ";37"); |         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (0 <= line && line < 2) ? ";31": ";37"); | ||||||
|         print_line("┃  2 Programm                           ┃", spaces, (1 <= line && line < 2) ? ";31": ";37"); |         print_line("┃  Programm 2                           ┃", spaces, (1 <= line && line < 2) ? ";31": ";37"); | ||||||
|         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (1 <= line && line < 3) ? ";31": ";37"); |         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (1 <= line && line < 3) ? ";31": ";37"); | ||||||
|         print_line("┃  3 Programm                           ┃", spaces, (2 <= line && line < 3) ? ";31": ";37"); |         print_line("┃  Programm 3                           ┃", spaces, (2 <= line && line < 3) ? ";31": ";37"); | ||||||
|         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (2 <= line && line < 4) ? ";31": ";37"); |         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (2 <= line && line < 4) ? ";31": ";37"); | ||||||
|         print_line("┃  4 Programm                           ┃", spaces, (3 <= line && line < 4) ? ";31": ";37"); |         print_line("┃  Programm 4                           ┃", spaces, (3 <= line && line < 4) ? ";31": ";37"); | ||||||
|         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (3 <= line && line < 5) ? ";31": ";37"); |         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (3 <= line && line < 5) ? ";31": ";37"); | ||||||
|         print_line("┃  5 Programm                           ┃", spaces, (4 <= line && line < 5) ? ";31": ";37"); |         print_line("┃  Programm 5                           ┃", spaces, (4 <= line && line < 5) ? ";31": ";37"); | ||||||
|         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (4 <= line && line < 6) ? ";31": ";37"); |         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (4 <= line && line < 6) ? ";31": ";37"); | ||||||
|         print_line("┃  6 Programm                           ┃", spaces, (5 <= line && line < 6) ? ";31": ";37"); |         print_line("┃  Programm 6                           ┃", spaces, (5 <= line && line < 6) ? ";31": ";37"); | ||||||
|         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (5 <= line && line < 7) ? ";31": ";37"); |         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (5 <= line && line < 7) ? ";31": ";37"); | ||||||
|         print_line("┃  7 Programm                           ┃", spaces, (6 <= line && line < 7) ? ";31": ";37"); |         print_line("┃  Programm 7                           ┃", spaces, (6 <= line && line < 7) ? ";31": ";37"); | ||||||
|         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (6 <= line && line < 8) ? ";31": ";37"); |         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (6 <= line && line < 8) ? ";31": ";37"); | ||||||
|         print_line("┃  8 Programm                           ┃", spaces, (7 <= line && line < 8) ? ";31": ";37"); |         print_line("┃  Programm 8                           ┃", spaces, (7 <= line && line < 8) ? ";31": ";37"); | ||||||
|         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (7 <= line && line < 9) ? ";31": ";37"); |         print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (7 <= line && line < 9) ? ";31": ";37"); | ||||||
|         print_line("┃  9 Programm                           ┃", spaces, (8 <= line && line < 9) ? ";31": ";37"); |         print_line("┃  Programm 9                           ┃", spaces, (8 <= line && line < 9) ? ";31": ";37"); | ||||||
|         print_line("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛", spaces, (8 <= line && line < 9) ? ";31": ";37"); |         print_line("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛", spaces, (8 <= line && line < 9) ? ";31": ";37"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -202,6 +218,7 @@ void print_help(){ | |||||||
|     printf("q \t Um das Programm zu beenden\n"); |     printf("q \t Um das Programm zu beenden\n"); | ||||||
|     printf("\nDrücke eine Taste um zurück zu kommen\n"); |     printf("\nDrücke eine Taste um zurück zu kommen\n"); | ||||||
|     char key_input = (char)getch(); |     char key_input = (char)getch(); | ||||||
|  |     // getchar();
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void get_terminal_size(int argc, char **argv, int *width, int *height){ | void get_terminal_size(int argc, char **argv, int *width, int *height){ | ||||||
| @ -210,6 +227,7 @@ void get_terminal_size(int argc, char **argv, int *width, int *height){ | |||||||
|         #elif _WIN32 |         #elif _WIN32 | ||||||
|             get_terminal_size_windows(argc, argv, width, height); |             get_terminal_size_windows(argc, argv, width, height); | ||||||
|         #endif |         #endif | ||||||
|  | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void get_terminal_size_init(int argc, char **argv, int *width, int *height){ | void get_terminal_size_init(int argc, char **argv, int *width, int *height){ | ||||||
| @ -235,18 +253,12 @@ void run_programm(int programm, int width, int height, bool *used){ | |||||||
|         case 2: return_code = test_gruppe_programmname(); break; |         case 2: return_code = test_gruppe_programmname(); break; | ||||||
|         case 3: return_code = test_gruppe_programmname(); break; |         case 3: return_code = test_gruppe_programmname(); break; | ||||||
|         case 4: return_code = test_gruppe_programmname(); break; |         case 4: return_code = test_gruppe_programmname(); break; | ||||||
|         case 5: return_code = test_gruppe_programmname(); break; |  | ||||||
|         case 6: return_code = test_gruppe_programmname(); break; |  | ||||||
|         case 7: return_code = test_gruppe_programmname(); break; |  | ||||||
|         case 8: return_code = test_gruppe_programmname(); break; |  | ||||||
|         case 9: return_code = test_gruppe_programmname(); break; |  | ||||||
|      |      | ||||||
|     } |     } | ||||||
|     switch (return_code) { |     switch (return_code) { | ||||||
|         case 10: used[programm] = 1; break; |         case 10: used[programm] = 1; break; | ||||||
|         case 20: print_game_over(width, height); break; |         case 20: print_game_over(width, height); break; | ||||||
|     } |     } | ||||||
|     // ist dazu da um "\n" aus dem buffer zu entfernen!
 |  | ||||||
|     getchar(); |     getchar(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -280,10 +292,6 @@ int main(int argc, char **argv){ | |||||||
|     bool run = true; |     bool run = true; | ||||||
|     bool *used = (bool[5]){0}; |     bool *used = (bool[5]){0}; | ||||||
|     int start_time = time(0); |     int start_time = time(0); | ||||||
|     bool arrows = false; |  | ||||||
|         if (argc >= 2 && strcmp(argv[1], "--ich-benutze-windows-und-bin-auf-die-pfeiltasten-angewiesen") == 0){ |  | ||||||
|             arrows = true; |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|     // umlaute für windows
 |     // umlaute für windows
 | ||||||
|     #ifdef _WIN32 |     #ifdef _WIN32 | ||||||
| @ -298,23 +306,16 @@ int main(int argc, char **argv){ | |||||||
|     // Terminal grösse herauslesen
 |     // Terminal grösse herauslesen
 | ||||||
|     get_terminal_size_init(argc, argv, &width, &height); |     get_terminal_size_init(argc, argv, &width, &height); | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     // print wellcome message
 |     // print wellcome message
 | ||||||
|     print_wellcome(width, height); |     print_wellcome(width, height); | ||||||
|      |  | ||||||
|     // Hauptschleife
 |  | ||||||
|     while(run){ |     while(run){ | ||||||
|         // liest die terminal grösse ein
 |  | ||||||
|         get_terminal_size_init(argc, argv, &width, &height); |         get_terminal_size_init(argc, argv, &width, &height); | ||||||
| 
 |  | ||||||
|         // zeigt das menu an
 |  | ||||||
|         print_menu(width, height, line); |         print_menu(width, height, line); | ||||||
| 
 | 
 | ||||||
|         // liest die Tastatur aus
 |  | ||||||
|         char key_input = (char)getch(); |         char key_input = (char)getch(); | ||||||
| 
 | 
 | ||||||
|         // verarbeitet die Tastatur eingabe
 |  | ||||||
|         switch (key_input) { |         switch (key_input) { | ||||||
|             // vim movement
 |  | ||||||
|             case 'k': line--; break; |             case 'k': line--; break; | ||||||
|             case 'j': line++; break; |             case 'j': line++; break; | ||||||
|             case 'g': { |             case 'g': { | ||||||
| @ -325,63 +326,34 @@ int main(int argc, char **argv){ | |||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|             case 'G': line = 8; break; |             case 'G': line = 8; break; | ||||||
|             case 'q': run = false; break; |  | ||||||
|             case '?': print_help(); break; |  | ||||||
| 
 | 
 | ||||||
|  |             case '?': print_help(); break; | ||||||
|             // case 'p': pipes(); break;
 |             // case 'p': pipes(); break;
 | ||||||
|              |              | ||||||
|             // windows
 |             case 'q': run = false; break; | ||||||
|             case -32:{ | 
 | ||||||
|                 key_input = (char)getch(); |             case 'A': open(); break; | ||||||
|                 if (arrows){ |             case 'B': open(); break; | ||||||
|                     switch (key_input){ |             case 'C': open(); break; | ||||||
|                         case 72: line--; break; // printf("up\n");
 |             case 'D': open(); break; | ||||||
|                         case 80: line++; break; // printf("down\n");
 |             case -32: open(); break; | ||||||
|                         // case 77: printf("right\n"); break;
 |  | ||||||
|                         // case 75: printf("left\n"); break;
 |  | ||||||
|                     } |  | ||||||
|                 } else{ |  | ||||||
|                     open(); |  | ||||||
|                 } |  | ||||||
|                 break; |  | ||||||
|             } |  | ||||||
|             // linux
 |  | ||||||
|             case 27:{ |  | ||||||
|                 key_input = (char)getch(); |  | ||||||
|                 key_input = (char)getch(); |  | ||||||
|                 if (arrows){ |  | ||||||
|                     switch (key_input){ |  | ||||||
|                         case 65: line--; break; // printf("up\n");
 |  | ||||||
|                         case 66: line++; break; // printf("down\n");
 |  | ||||||
|                         // case 67: printf("right\n"); break;
 |  | ||||||
|                         // case 68: printf("left\n"); break;
 |  | ||||||
|                     } |  | ||||||
|                 } else { |  | ||||||
|                     open(); |  | ||||||
|                 } |  | ||||||
|                 break; |  | ||||||
|             } |  | ||||||
| 
 | 
 | ||||||
|             // enter unter linux
 |  | ||||||
|             case '\n': run_programm(line, width, height, used); break; |             case '\n': run_programm(line, width, height, used); break; | ||||||
|             // enter under windows
 |  | ||||||
|             case 13 : run_programm(line, width, height, used); break; |             case 13 : run_programm(line, width, height, used); break; | ||||||
| 
 |  | ||||||
|             // schnell start
 |  | ||||||
|             case '1': run_programm(0, width, height, used); break; |             case '1': run_programm(0, width, height, used); break; | ||||||
|             case '2': run_programm(1, width, height, used); break; |             case '2': run_programm(1, width, height, used); break; | ||||||
|             case '3': run_programm(2, width, height, used); break; |             case '3': run_programm(2, width, height, used); break; | ||||||
|             case '4': run_programm(3, width, height, used); break; |             case '4': run_programm(3, width, height, used); break; | ||||||
|             case '5': run_programm(4, width, height, used); break; |             case '5': run_programm(4, width, height, used); break; | ||||||
|              |              | ||||||
|             default: printf(" Es wurde die Taste: %i gedrückt\n", key_input); // getch();
 |             // default: printf(" Es wurde die Taste: %c gedrückt", key_input); getch();
 | ||||||
|         } |         } | ||||||
|         if(line < 0){line = 8;} |         if(line < 0){line = 8;} | ||||||
|         if(line > 8){line = 0;} |         if(line > 8){line = 0;} | ||||||
|         speed(width, height, &start_time, used); |         speed(width, height, &start_time, used); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // zurück zum alten terminal (nur linux)
 |     // zürück zum alten terminal (nur linux)
 | ||||||
|     #ifdef __linux__ |     #ifdef __linux__ | ||||||
|         system("tput rmcup"); |         system("tput rmcup"); | ||||||
|     #endif |     #endif | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user