1 Commits
Author SHA1 Message Date
Mapama f4e920ce5b feat: Logik in input.c implementiert 2026-10-26 08:20:48 +01:00
6 changed files with 24 additions and 23 deletions

No files matched your search

+1 -2
View File
@@ -35,10 +35,9 @@
*.i*86
*.x86_64
*.hex
Startcode/wordsalad_myversion
Startcode/wordsalad_initial
Startcode/wordsalad
runtest
test
# Debug files
*.dSYM/
+20
View File
@@ -8,5 +8,25 @@
// Read words from file and store in 'words' array
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{
if (file == NULL) {
return 0;
}
char line[MAX_LINE_LEN];
unsigned int count = 0;
while (fgets(line, sizeof(line), file) != NULL && count < maxWordCount) {
char *token = strtok(line, " ,;\n\r\t");
while (token != NULL & count < maxWordCount) {
if (strlen(token) > 0) {
strncpy(words[count], token, MAX_WORD_LEN - 1);
words[count][MAX_WORD_LEN - 1] = '\0';
for (int i= 0; words[count][i] != '\0'; i++) {
words[count][i] = toupper((unsigned char)words[count][i]);
}
count++;
}
token = strtok(NULL, " ,;\n\r\t");
}
}
return count;
}
+2 -14
View File
@@ -38,20 +38,8 @@ int main(int argc, char *argv[])
// TODO:
// Check if all words were successfully placed
if (placedWords == wordCount)
{
// Start the game if successful
startGame(wordSalad, SALAD_SIZE, words, wordCount, 600);
}
else
{
// error message if some words couldn't be placed
fprintf(stderr, "Fehler. Es konnten nicht alle Wörter Platziert werden.");
exitCode = EXIT_FAILURE;
}
// Start the game if successful
// error message if some words couldn't be placed
}
else
+1 -7
View File
@@ -22,12 +22,6 @@ codefolder = .
wordsalad_initial:
$(CC) -o wordsalad_initial -L. $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS)
# Eigenes Target
wordsalad_myversion: main.o graphicalGame.o $(BINARIES)/libraylib.a
$(CC) $(CFLAGS) -o wordsalad_myversion main.o graphicalGame.o $(BINARIES)/libwordsalad.a $(BINARIES)/libraylib.a $(LDFLAGS)
# --------------------------
# Normales Spiel bauen
# --------------------------
@@ -61,5 +55,5 @@ clean:
ifeq ($(OS),Windows_NT)
del /f *.o *.exe
else
rm -f *.o wordsalad wordsalad_initial wordsalad_myversion $(TEST_BIN)
rm -f *.o wordsalad $(TEST_BIN)
endif
Binary file not shown.
Binary file not shown.