d410aaa9ec7a755c38c3d62c45bf9ac4173d29f9
[supertux.git] / src / supertux.cpp
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 // 
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 //  02111-1307, USA.
20
21 #include <sys/types.h>
22 #include <ctype.h>
23
24 #include "defines.h"
25 #include "globals.h"
26 #include "setup.h"
27 #include "intro.h"
28 #include "title.h"
29 #include "gameloop.h"
30 #include "leveleditor.h"
31 #include "screen.h"
32 #include "worldmap.h"
33 #include "resources.h"
34
35 int main(int argc, char * argv[])
36 {
37   st_directory_setup();
38   parseargs(argc, argv);
39   
40   st_audio_setup();
41   st_video_setup();
42   st_joystick_setup();
43   st_general_setup();
44   st_menu();
45   loadshared();
46
47   if (launch_worldmap_mode)
48     {
49       WorldMapNS::WorldMap worldmap;
50       worldmap.display();
51     }
52   else if (level_startup_file)
53     {
54       GameSession session(level_startup_file, 1, ST_GL_LOAD_LEVEL_FILE);
55       session.run();
56     }
57   else
58     {  
59       title();
60     }
61   
62   clearscreen(0, 0, 0);
63   updatescreen();
64
65   unloadshared();
66   st_shutdown();
67   
68   return 0;
69 }