Browse Source

fix running bug

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
2ce5b23ec5
  1. 33
      CMakeLists.txt
  2. 12
      src/main/c/Pong/pong.c

33
CMakeLists.txt

@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.26)
project(arcade C)
set(CMAKE_C_STANDARD 11)
include_directories(src/main/c)
include_directories(src/main/c/GameTic_Tac_Toe)
include_directories(src/main/c/Hangman)
include_directories(src/main/c/Minesweeper)
include_directories(src/main/c/Pong)
include_directories(src/main/c/Snake)
add_executable(arcade
src/main/c/GameTic_Tac_Toe/tictactoe.c
src/main/c/GameTic_Tac_Toe/tictactoe.h
src/main/c/Hangman/drawHangman.c
src/main/c/Hangman/drawHangman.h
src/main/c/Hangman/initializeHangman.c
src/main/c/Hangman/initializeHangman.h
src/main/c/Hangman/playHangman.c
src/main/c/Hangman/playHangman.h
src/main/c/Hangman/word_selector.c
src/main/c/Hangman/word_selector.h
src/main/c/Minesweeper/minesweeper_start.c
src/main/c/Minesweeper/minesweeper_start.h
src/main/c/Pong/pong.c
src/main/c/Pong/pong.h
src/main/c/Snake/get_character.c
src/main/c/Snake/get_character.h
src/main/c/Snake/snake_start.c
src/main/c/Snake/snake_start.h
src/main/c/main.c
src/main/c/main.h)

12
src/main/c/Pong/pong.c

@ -55,7 +55,7 @@ void drawField(int paddle1PositionY, int paddle2PositionY, Ball ball, int score1
printf("Drücken Sie 'q', um das Spiel zu beenden.\n");
}
int kbhit(void){
int kb_hit(void){
struct termios oldt, newt;
int ch, oldf;
@ -78,7 +78,7 @@ int kbhit(void){
return 0;
}
int getch(void) {
int get_ch(void) {
int ch;
while ((ch = getchar()) == '\n');
@ -157,8 +157,8 @@ int pong(){
while (score1 < maxScore && score2 < maxScore) {
//Steuerung für Schläger 1
if (!isPaused && kbhit()){
char input = getch();
if (!isPaused && kb_hit()){
char input = get_ch();
if (input == 'w' && paddle1PositionY > 1)
{
paddle1PositionY--;
@ -174,8 +174,8 @@ int pong(){
}
//Steuerung für Schläger 2
if (!isPaused && kbhit()){
char input = getch();
if (!isPaused && kb_hit()){
char input = get_ch();
if (input == 'i' && paddle2PositionY > 1){
paddle2PositionY--;
} else if (input == 'k' && paddle2PositionY < HEIGHT - PADDLE_LENGTH - 1){

Loading…
Cancel
Save