summaryrefslogtreecommitdiffstats
path: root/src/main.c
blob: fbb8561ad0ce9fe1d9c010a8e47c0162163537d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/******************************************************************************
 *	Copyright (C) 2015	Alejandro Colomar Andrés		      *
 ******************************************************************************/


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
/*	*	*	*	*	*	*	*	*	*
 *	*	* Standard	*	*	*	*	*	*
 *	*	*	*	*	*	*	*	*	*/
	#include <gtk/gtk.h>
		/* getchar() */
	#include <stdio.h>

/*	*	*	*	*	*	*	*	*	*
 *	*	* Other	*	*	*	*	*	*	*
 *	*	*	*	*	*	*	*	*	*/
	#include "alx_ncur.h"

		/* about_init() & print_cpright() */
	#include "about.h"
	#include "game.h"
	#include "menu_iface.h"
	#include "player_iface.h"
	#include "parser.h"
	#include "save.h"
	#include "score.h"
	#include "start.h"


/******************************************************************************
 ******* static functions *****************************************************
 ******************************************************************************/
void	init_all	(int *argc, char *(*argv[]));
void	cleanup		(void);


/******************************************************************************
 ******* main *****************************************************************
 ******************************************************************************/
int	main	(int argc, char *argv[])
{
	init_all(&argc, &argv);

	/* Print copyright () and wait for any key to continue */
	print_share_file(SHARE_COPYRIGHT);
	getchar();

	/* Start () */
	start_switch();

	/* Menu () */
	menu_iface();

	cleanup();

	return	0;
}


/******************************************************************************
 ******* static functions *****************************************************
 ******************************************************************************/
void	init_all	(int *argc, char *(*argv[]))
{
	/* Init gtk & curses */
	gtk_init_check(argc, argv);
	alx_start_curses();
	alx_pause_curses();

	/* Init modules */
	menu_iface_init();
	game_init();
	about_init();
	save_init();
	score_init();

	/* Modes */
	start_mode		= START_FOO;
	flag_exit		= false;
	menu_iface_mode		= MENU_IFACE_TUI;
	player_iface_mode	= PLAYER_IFACE_TUI;

	/* Parse command line options */
	parser(*argc, *argv);

	/* Init iface */
	menu_iface_init_iface();
}

void	cleanup		(void)
{
	/* Clean iface */
	menu_iface_cleanup();

	/* End curses */
	alx_resume_curses();
	alx_end_curses();
}


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/