Browse Source

added function processInput and exit of game

remotes/origin/navigation
KRUGSON 2 years ago
parent
commit
c506575b0d
  1. 17
      src/c/main.c

17
src/c/main.c

@ -13,6 +13,7 @@ char *gameInstructionsFile = "../../src/content/game_instructions.txt";
// function declarations // function declarations
void printInit(); void printInit();
void acceptInstructions(); void acceptInstructions();
void processInput();
int main() int main()
{ {
@ -34,7 +35,7 @@ int main()
// NEXT STEP: // NEXT STEP:
// Processing // Processing
// processInput(userInput);
processInput(userInput);
} }
} }
return 0; return 0;
@ -93,4 +94,18 @@ void acceptInstructions()
printf("Invalid Input!\n"); printf("Invalid Input!\n");
} }
} }
}
//process user input
void processInput(char userInput[20])
{
if (strcmp(userInput, "esc") == 0 || strcmp(userInput, "exit") == 0 || strcmp(userInput, "quit") == 0)
{
gameRunning = 0;
printf("!GAME EXIT!\n");
}
else
{
printf("Wrong Input!\n");
}
} }
Loading…
Cancel
Save