diff --git a/src/main/c/Minesweeper/minesweeper_start.c b/src/main/c/Minesweeper/minesweeper_start.c new file mode 100644 index 0000000..7b28bd1 --- /dev/null +++ b/src/main/c/Minesweeper/minesweeper_start.c @@ -0,0 +1,62 @@ +#include +#include +#define BLOCK 219 +#define FLAG '?' +#define EMPTY ' ' + + +#pragma region Funktion_heads +void main_menu_minesweeper(); +void game_minesweeper(); +void options_minesweeper(); +#pragma endregion + +#pragma region Global +#pragma endregion //Global + + +int minesweeper_start(){ + system("clear"); + main_menu_minesweeper(); +} + +void main_menu_minesweeper(){ + bool running = true; + while (running){ + int option = 0; + + system("clear"); + printf("Waehlen Sie eine Option:\n"); + printf("\t1.Start\n"); + printf("\t2.Options\n"); + printf("\t3.Exit\n"); + + scanf("%d", &option); + getchar(); + + system("clear"); + + switch (option){ + case 1: + game_minesweeper(); + break; + case 2: + options_minesweeper(); + break; + case 3: + running = false; + break; + + default: + break; + } + } +} + +void game_minesweeper(){ + +} + +void options_minesweeper(){ + +} \ No newline at end of file diff --git a/src/main/c/Minesweeper/minesweeper_start.h b/src/main/c/Minesweeper/minesweeper_start.h new file mode 100644 index 0000000..1bb6a7d --- /dev/null +++ b/src/main/c/Minesweeper/minesweeper_start.h @@ -0,0 +1,16 @@ +#ifndef MINESWEEPER_START_H +#define MINESWEEPER_START_H + +typedef struct Minesweeper_Board{ + unsigned int width; + unsigned int height; + char *tiles; + int num_bombs; + unsigned int bombs[]; +}Minesweeper_Board; + + +void minesweeper_start(); + + +#endif // MINESWEEPER_START_H \ No newline at end of file diff --git a/src/main/c/Snake/snake_start.c b/src/main/c/Snake/snake_start.c index f6b7996..f3ce799 100644 --- a/src/main/c/Snake/snake_start.c +++ b/src/main/c/Snake/snake_start.c @@ -5,15 +5,17 @@ #include #include "snake_start.h" #include "get_character.h" +#define WIDTH 15 +#define HEIGHT 15 #define TURN 0.5 #define START_LENGTH 3 #define START_DIRECTION 1 #define START_TILE 8 * 16 + 8 #pragma region Funktion_heads -void main_menu(); -void game(); -void options(); +void main_menu_snake(); +void game_snake(); +void options_snake(); Snake initialize_snake(); void get_next_move(double limit, Snake *snake, bool *running); void move_snake(Snake *snake); @@ -30,10 +32,10 @@ double TIME_TURN = 0.5; void snake_start(){ system("clear"); - main_menu(); + main_menu_snake(); } -void main_menu(){ +void main_menu_snake(){ bool running = true; while (running){ int option = 0; @@ -51,10 +53,10 @@ void main_menu(){ switch (option){ case 1: - game(); + game_snake(); break; case 2: - options(); + options_snake(); break; case 3: running = false; @@ -66,7 +68,7 @@ void main_menu(){ } } -void game(){ +void game_snake(){ Snake snake = initialize_snake(); bool running = true; clock_t t = clock(); @@ -84,12 +86,12 @@ void game(){ } } -void options(){ +void options_snake(){ int difficulty = 1; system("clear"); printf("Please select a difficulty(1 - 10): "); scanf("%d", &difficulty); - TIME_TURN = TURN / difficulty;//(11 - difficulty) * TURN / 10; + TIME_TURN = TURN / difficulty; } Snake initialize_snake(){ diff --git a/src/main/c/Snake/snake_start.h b/src/main/c/Snake/snake_start.h index 1634146..359f548 100644 --- a/src/main/c/Snake/snake_start.h +++ b/src/main/c/Snake/snake_start.h @@ -1,14 +1,10 @@ #ifndef SNAKE_START_H #define SNAKE_START_H -#define HEIGHT 15 -#define WIDTH 15 -#define AREA HEIGHT * WIDTH - -typedef struct{ +typedef struct Snake{ signed char direction; char length; - unsigned char segments[AREA]; + unsigned char segments[225]; }Snake; diff --git a/src/main/c/main.c b/src/main/c/main.c index 922c8d4..11be6b7 100644 --- a/src/main/c/main.c +++ b/src/main/c/main.c @@ -2,8 +2,8 @@ #include #include -#include "Template/game100.h" #include "Snake/snake_start.h" +#include "Minesweeper/minesweeper_start.h" int main(){ bool running = true; @@ -18,8 +18,8 @@ int main(){ printf("\t2.Spiel2 starten\n"); printf("\t3.Snake starten\n"); printf("\t4.Spiel4 starten\n"); - printf("\t100.Template starten\n"); - printf("\t6.Exit\n"); + printf("\t7.Minesweeper starten\n"); + printf("\t10.Exit\n"); scanf("%d", &option); getchar(); @@ -37,10 +37,10 @@ int main(){ case 4: //start_game4(); break; - case 100: - start_game100(); + case 7: + minesweeper_start(); break; - case 6: + case 10: system("clear"); running = false; break;