From 9e27997e44f2cb7b5842b1ec0cd815e6a8aa5c25 Mon Sep 17 00:00:00 2001 From: Hofmann Jonas Date: Fri, 24 Oct 2025 00:23:29 +0200 Subject: [PATCH] =?UTF-8?q?In=20main.c=20die=20Initialisierung=20des=20Spi?= =?UTF-8?q?els=20erg=C3=A4nzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Start_Windows/main.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Start_Windows/main.c b/Start_Windows/main.c index 03da755..c591f9c 100644 --- a/Start_Windows/main.c +++ b/Start_Windows/main.c @@ -7,6 +7,13 @@ #define MAX_NUMBER_OF_WORDS 100 #define SALAD_SIZE 20 +// selbstgeschriebene Definitionen: +// annahmen ist das windowWidth in pixeln gegeben +// werden muss, da auch andere funktionen wie +// createCharSquarePanel in Pixeln arbeiten +#define WINDOW_WIDTH 540 + + int main(int argc, char *argv[]) { int exitCode = EXIT_SUCCESS; @@ -36,10 +43,24 @@ int main(int argc, char *argv[]) // Create the word salad by placing words into grid placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount); - // TODO: + // DONE: // Check if all words were successfully placed // Start the game if successful // error message if some words couldn't be placed + if (placedWords != wordCount) + { + // selbe error message wird auch von wordsalad_inital.exe ausgegeben, + // wenn diese einen fehler produziert + printf("Could only place %d of %d words.", placedWords, wordCount); + printf(" Possible solution is to choose a larger search field ...\n"); + } + else + { + // annahme: windowWidth wird in Pixeln gesucht, + // da auch andere funktionen, wie createCharSquarePanel + // in Pixeln arbeiten + startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, placedWords, WINDOW_WIDTH); + } } else