Final commit
This commit is contained in:
parent
3a7cb92591
commit
b39607861d
@ -113,7 +113,7 @@ void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN],
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
/*int main(void)
|
||||||
{
|
{
|
||||||
// Spielfeldgröße
|
// Spielfeldgröße
|
||||||
unsigned int searchFieldLen = 15;
|
unsigned int searchFieldLen = 15;
|
||||||
@ -143,7 +143,7 @@ int main(void)
|
|||||||
showWordSalad(salad, searchFieldLen);
|
showWordSalad(salad, searchFieldLen);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
Start_Windows/game.o
Normal file
BIN
Start_Windows/game.o
Normal file
Binary file not shown.
@ -2,7 +2,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "graphicalGame.h"
|
#include "graphicalGame.h"
|
||||||
#include "raylib.h"
|
#include "raylib/raylib.h"
|
||||||
|
|
||||||
#define MAX_MESSAGE_LEN 256
|
#define MAX_MESSAGE_LEN 256
|
||||||
#define MAX_SOLUTION_WORD_LEN 16
|
#define MAX_SOLUTION_WORD_LEN 16
|
||||||
|
|||||||
BIN
Start_Windows/graphicalGame.o
Normal file
BIN
Start_Windows/graphicalGame.o
Normal file
Binary file not shown.
@ -8,5 +8,41 @@
|
|||||||
// Read words from file and store in 'words' array
|
// Read words from file and store in 'words' array
|
||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||||
{
|
{
|
||||||
|
int wordCount = 0;
|
||||||
|
char line[MAX_WORD_LEN];
|
||||||
|
|
||||||
|
while (wordCount < maxWordCount && fgets(line, MAX_LINE_LEN, file) != NULL){
|
||||||
|
|
||||||
|
line[strcspn(line, "\n")] ='\0';
|
||||||
|
|
||||||
|
/*strncpy(words[wordCount], tempBuffer, MAX_WORD_LEN -1);
|
||||||
|
words[wordCount][MAX_WORD_LEN - 1] = '\0';*/
|
||||||
|
const char *teiler = ";,\n ";
|
||||||
|
char *token;
|
||||||
|
|
||||||
|
token = strtok(line, teiler);
|
||||||
|
|
||||||
|
while (token != NULL){
|
||||||
|
strncpy(words[wordCount], token, MAX_WORD_LEN);
|
||||||
|
words[wordCount][MAX_WORD_LEN-1] = '\0';
|
||||||
|
for (int i = 0; words[wordCount][i] != '0'; i++){
|
||||||
|
char currentLetter = words[wordCount][i];
|
||||||
|
if (currentLetter >= 'a' && currentLetter <= 'z'){
|
||||||
|
words[wordCount][i] = currentLetter - ('a' - 'A');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
token = strtok(NULL, teiler);
|
||||||
|
wordCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*for (int i = 0; words[wordCount][i] != 0 && i < MAX_WORD_LEN; i++) {
|
||||||
|
|
||||||
|
char currentLetter = words[wordCount][i];
|
||||||
|
if (currentLetter >= 'a' && currentLetter <= 'z'){
|
||||||
|
words[wordCount][i] = currentLetter - ('a'-'A');
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
return wordCount;
|
||||||
}
|
}
|
||||||
BIN
Start_Windows/input.o
Normal file
BIN
Start_Windows/input.o
Normal file
Binary file not shown.
@ -33,6 +33,8 @@ int main(int argc, char *argv[])
|
|||||||
wordCount = readWords(file, words, MAX_NUMBER_OF_WORDS);
|
wordCount = readWords(file, words, MAX_NUMBER_OF_WORDS);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
|
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
||||||
|
|
||||||
// Create the word salad by placing words into grid
|
// Create the word salad by placing words into grid
|
||||||
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
||||||
|
|
||||||
@ -40,7 +42,10 @@ int main(int argc, char *argv[])
|
|||||||
// Check if all words were successfully placed
|
// Check if all words were successfully placed
|
||||||
// Start the game if successful
|
// Start the game if successful
|
||||||
// error message if some words couldn't be placed
|
// error message if some words couldn't be placed
|
||||||
|
if (placedWords == wordCount) {
|
||||||
|
printf("Starting Game\n");
|
||||||
|
startGame(wordSalad, SALAD_SIZE, words, wordCount, 800);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
BIN
Start_Windows/main.o
Normal file
BIN
Start_Windows/main.o
Normal file
Binary file not shown.
@ -43,3 +43,10 @@ test: input.o game.o unit_tests.c
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
clean:
|
clean:
|
||||||
del /f *.o *.exe
|
del /f *.o *.exe
|
||||||
|
OBJS_MYVERSION = main.o input.o game.o graphicalGame.o
|
||||||
|
|
||||||
|
wordsalad_myversion: $(OBJS_MYVERSION)
|
||||||
|
$(CC) -o wordsalad_myversion $(OBJS_MYVERSION) $(BINARIES)/libwordsalad.a $(BINARIES)/libraylib.a $(LDFLAGS)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) -c $< -o $@ $(CFLAGS)
|
||||||
Loading…
x
Reference in New Issue
Block a user