1 /*---------------------------------------------------------------------------/
2 / Chryzodus - A chryzode explorer                                            /
3 / http://chryzodus.sourceforge.net                                           /
4 / Copyright (C) 2004 Florian LHERBETTE                                       /
5 /                                                                            /
6 /----------------------------------------------------------------------------/
7 /                                                                            /
8 / This program is free software; you can redistribute it and/or              /
9 / modify it under the terms of the GNU General Public License                /
10 / as published by the Free Software Foundation; either version 2             /
11 / of the License, or (at your option) any later version.                     /
12 /                                                                            /
13 / This program is distributed in the hope that it will be useful,            /
14 / but WITHOUT ANY WARRANTY; without even the implied warranty of             /
15 / MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              /
16 / GNU General Public License for more details.                               /
17 /                                                                            /
18 / You should have received a copy of the GNU General Public License          /
19 / along with this program; if not, write to the Free Software                /
20 / Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA./
21 /                                                                            /
22 /----------------------------------------------------------------------------/
23 /                                                                            /
24 / Chryzodus version 0.32                                                     /
25 / main.cpp : Main source file                                                /
26 /                                                                            /
27 /---------------------------------------------------------------------------*/
28 
29 #include <allegro.h>
30 #include "gui.h"
31 #include "compute.h"
32 
33 int close_button_clicked = 0;
34 
close_button_callback(void)35 void close_button_callback(void)
36 {
37 	close_button_clicked = 1;
38 }
39 
main(void)40 int main(void)
41 {
42 	BITMAP *buffer;
43 	Cchryzode *chryzode;
44 	char status[128]; // hum on prevoit large... Au fait pourquoi le declarer ici ?
45 	DIALOG_PLAYER *player;
46 	int done = 0;
47 
48 	allegro_init();
49 	install_keyboard();
50 	install_timer();
51 	install_mouse();
52 
53 	// initialisation graphique... A REVOIR !
54 	set_color_depth(desktop_color_depth());
55 	if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0)) set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
56 
57 	set_window_title("Chryzodus - a chryzode explorer");
58 	set_close_button_callback(close_button_callback);
59 
60 	buffer = create_bitmap(SCREEN_W, SCREEN_H);
61 	clear(buffer);
62 	chryzode = new Cchryzode(buffer);
63 	main_dialog[MAIN_D_CHRYZODE].dp = buffer;
64 	main_dialog[MAIN_D_CHRYZODE].dp2 = chryzode;
65 	main_dialog[MAIN_D_CHRYZODE].w = buffer->w;
66 	main_dialog[MAIN_D_CHRYZODE].h = buffer->h;
67 	usprintf(status, "Chryzodus 0.31");
68 	main_dialog[MAIN_D_STATUS].dp = status;
69 	set_dialog_color(main_dialog, gui_fg_color, gui_bg_color);
70 
71 	show_mouse(screen);
72 
73 	player = init_dialog(main_dialog, -1);
74 	while (!done)
75 	{
76 		if (update_dialog(player)==0)
77 			if (player->obj!=-1) done = 1;
78 		if (close_button_clicked) done = 1;
79 	}
80 	shutdown_dialog(player);
81 
82 	delete chryzode;
83 	return 0;
84 }
85 END_OF_MAIN();
86