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

Declares application initialization, shutdown, and main entry point. More...

Go to the source code of this file.

Enumerations

enum  exit_code_t {
  SUCCESS , FAIL_TB_INIT , FAIL_MEM_POOL_INIT , FAIL_LOCAL_INIT ,
  FAIL_IO_HANDLER_INIT , FAIL_MAIN_MENU_INIT , FAIL_SAVE_MENU_INIT , FAIL_LANGUAGE_INIT ,
  FAIL_GAME_MODE_INIT , FAIL_INVENTORY_MODE_INIT , FAIL_GAME_ENTITY_INIT , FAIL_STATS_MODE_INIT ,
  FAIL_ERROR
}

Functions

int main (void)
 Main entry point for the application.

Variables

volatile int init_done

Detailed Description

Declares application initialization, shutdown, and main entry point.

Definition in file main.h.

Enumeration Type Documentation

◆ exit_code_t

enum exit_code_t

Definition at line 10 of file main.h.

10 {
11 SUCCESS,
12 FAIL_TB_INIT,
13 FAIL_MEM_POOL_INIT,
14 FAIL_LOCAL_INIT,
15 FAIL_IO_HANDLER_INIT,
16 FAIL_MAIN_MENU_INIT,
17 FAIL_SAVE_MENU_INIT,
18 FAIL_LANGUAGE_INIT,
19 FAIL_GAME_MODE_INIT,
20 FAIL_INVENTORY_MODE_INIT,
21 FAIL_GAME_ENTITY_INIT,
22 FAIL_STATS_MODE_INIT,
23 FAIL_ERROR,
24} exit_code_t;

Function Documentation

◆ main()

int main ( void )

Main entry point for the application.

This function initializes the game, runs the main game loop, and performs cleanup before exiting. It handles the overall flow of the application.

Returns
Exit code indicating success or failure.

Definition at line 178 of file main.c.

178 {
179 const int exit_code = init();
180 if (exit_code != COMMON_SUCCESS) {
182 return exit_code;
183 }
184 run_game();
186 return exit_code;
187}
#define COMMON_SUCCESS
Common success return value.
Definition common.h:146
void run_game()
Starts the game loop.
Definition game.c:62
int init()
Initializes all necessary parts and subsystems for the game.
Definition main.c:75
void shutdown_game(void)
Frees all allocated resources and performs cleanup tasks for the game.
Definition main.c:158

Variable Documentation

◆ init_done

volatile int init_done
extern

Definition at line 31 of file main.c.