DungeonCrawl
Loading...
Searching...
No Matches
main_menu_local.h File Reference

Exposes functionality for the localization of the main menu. More...

Go to the source code of this file.

Enumerations

enum  main_menu_index {
  NEW_GAME_STR , CONTINUE_STR , SAVE_GAME_STR , LOAD_GAME_STR ,
  CHANGE_LANGUAGE_STR , EXIT_STR , QUESTION_CONTINUE , QUESTION_EXIT ,
  MAX_MAIN_MENU_STRINGS
}

Functions

void update_main_menu_local (void)
 Updates the localized strings for the main menu.

Variables

char ** main_menu_strings

Detailed Description

Exposes functionality for the localization of the main menu.

Definition in file main_menu_local.h.

Enumeration Type Documentation

◆ main_menu_index

enum main_menu_index

Definition at line 8 of file main_menu_local.h.

8 {
9 NEW_GAME_STR,
10 CONTINUE_STR,
11 SAVE_GAME_STR,
12 LOAD_GAME_STR,
13 CHANGE_LANGUAGE_STR,
14 EXIT_STR,
15 QUESTION_CONTINUE,
16 QUESTION_EXIT,
17
18 MAX_MAIN_MENU_STRINGS
19};

Function Documentation

◆ update_main_menu_local()

void update_main_menu_local ( void )

Updates the localized strings for the main menu.

This function retrieves the localized strings for the main menu and updates the corresponding entries in the main menu strings array.

Definition at line 13 of file main_menu_local.c.

13 {
14 for (int i = 0; i < MAX_MAIN_MENU_STRINGS; i++) {
15 if (main_menu_strings[i] != NULL) {
16 free(main_menu_strings[i]);
17 }
18 }
19
20 main_menu_strings[NEW_GAME_STR] = get_local_string("MAIN_MENU.NEW_GAME");
21 main_menu_strings[CONTINUE_STR] = get_local_string("MAIN_MENU.CONTINUE");
22 main_menu_strings[SAVE_GAME_STR] = get_local_string("MAIN_MENU.SAVE_GAME");
23 main_menu_strings[LOAD_GAME_STR] = get_local_string("MAIN_MENU.LOAD_GAME");
24 main_menu_strings[CHANGE_LANGUAGE_STR] = get_local_string("MAIN_MENU.CHANGE_LANGUAGE");
25 main_menu_strings[EXIT_STR] = get_local_string("MAIN_MENU.EXIT");
26 main_menu_strings[QUESTION_CONTINUE] = get_local_string("MAIN_MENU.QUESTION.CONTINUE");
27 main_menu_strings[QUESTION_EXIT] = get_local_string("MAIN_MENU.QUESTION.EXIT");
28}
char * get_local_string(const char *key)
Get the localized string for the given key.

Variable Documentation

◆ main_menu_strings

char** main_menu_strings
extern

Definition at line 11 of file main_menu_local.c.