From 6c33a64a5d37897cf9a50935cd5835226cd00b73 Mon Sep 17 00:00:00 2001 From: fdai8040 Date: Wed, 31 Jan 2024 21:00:19 +0000 Subject: [PATCH] Stoppen des Spiels --- src/main/c/Pong/game.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/c/Pong/game.c b/src/main/c/Pong/game.c index 835c600..b50acba 100644 --- a/src/main/c/Pong/game.c +++ b/src/main/c/Pong/game.c @@ -50,6 +50,7 @@ void drawField(int paddle1PositionY, int paddle2PositionY, Ball ball, int score1 } else { printf("Drücken Sie 'p', um das Spiel zu pausieren.\n"); } + printf("Drücken Sie 'q', um das Spiel zu beenden.\n"); } int kbhit(void){ @@ -141,8 +142,12 @@ int main(){ paddle1PositionY++; } else if (input == 'p') { isPaused = !isPaused; - } + } else if (input == 'q') { + clearScreen(); + printf("Spiel beendet.\n"); + return 0; } + } //Steuerung für Schläger 2 if (!isPaused && kbhit()){ @@ -153,6 +158,10 @@ int main(){ paddle2PositionY++; } else if (input == 'p') { isPaused = !isPaused; + } else if (input == 'q') { + clearScreen(); + printf("Spiel beendet.\n"); + return 0; } }