Start_Windows/graphicalGame.c aktualisiert
This commit is contained in:
parent
c6e0cbd667
commit
6bf06ab198
@ -66,8 +66,27 @@ typedef struct
|
|||||||
// Creates a helper message to guide the user
|
// Creates a helper message to guide the user
|
||||||
static HelperMessage createHelperMessage(unsigned int screenWidth)
|
static HelperMessage createHelperMessage(unsigned int screenWidth)
|
||||||
{
|
{
|
||||||
const char *text = "Please search below for the words located at the bottom \nand draw a line exactly on the desired characters ...";
|
// Der Hilfetext, der dem Spieler angezeigt wird, um das Spielprinzip zu erklären
|
||||||
HelperMessage msg = {"", {0, 0}, {screenWidth, 0}, 18};
|
const char *text = "Please search below for the words located at the bottom \n"
|
||||||
|
"and draw a line exactly on the desired characters ...";
|
||||||
|
|
||||||
|
// Initialisiert eine HelperMessage-Struktur:
|
||||||
|
// - text: der Hinweistext
|
||||||
|
// - start: Startposition des Textes (x=0, y=0)
|
||||||
|
// - end: Endposition des Textes (x=screenWidth, y=0) – also über die gesamte Breite
|
||||||
|
// - fontSize: Schriftgröße des Textes (hier: 18)
|
||||||
|
HelperMessage msg = { "", {0, 0}, {screenWidth, 0}, 18 };
|
||||||
|
|
||||||
|
// Kopiert den Hinweistext in das msg.text-Feld (sicher mit strncpy)
|
||||||
|
strncpy(msg.text, text, sizeof(msg.text) - 1);
|
||||||
|
|
||||||
|
// Stellt sicher, dass der Text nullterminiert ist
|
||||||
|
msg.text[sizeof(msg.text) - 1] = '\0';
|
||||||
|
|
||||||
|
// Gibt die fertige HelperMessage zurück
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
``
|
||||||
|
|
||||||
// Copy text into msg, ensuring does not exceed max length
|
// Copy text into msg, ensuring does not exceed max length
|
||||||
strncpy(msg.text, text, MAX_MESSAGE_LEN);
|
strncpy(msg.text, text, MAX_MESSAGE_LEN);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user