refactored some supertux mainloops
[supertux.git] / src / title.hpp
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 //  Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 //
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License
9 //  as published by the Free Software Foundation; either version 2
10 //  of the License, or (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 // 
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 //  02111-1307, USA.
21 #ifndef SUPERTUX_TITLE_H
22 #define SUPERTUX_TITLE_H
23
24 #include <memory>
25 #include <vector>
26 #include "screen.hpp"
27 #include "game_session.hpp"
28
29 class Menu;
30 class World;
31 class CodeController;
32
33 class TitleScreen : public Screen
34 {
35 public:
36   TitleScreen();
37   virtual ~TitleScreen();
38
39   virtual void setup();
40
41   virtual void draw(DrawingContext& context);
42
43   virtual void update(float elapsed_time);
44
45 private:
46   std::string get_slotinfo(int slot);
47   std::string get_level_name(const std::string& levelfile);
48   bool process_load_game_menu();
49   void make_tux_jump();
50   void update_load_game_menu();
51   void generate_contrib_menu();
52   void check_levels_contrib_menu();
53   void check_contrib_world_menu();
54   void free_contrib_menu();
55
56   std::auto_ptr<Menu> load_game_menu;
57   std::auto_ptr<Menu> contrib_menu;
58   std::auto_ptr<Menu> contrib_world_menu;
59   std::vector<World*> contrib_worlds;
60   int current_world;
61   World* current_contrib_world;
62   
63   std::auto_ptr<CodeController> controller;
64   std::auto_ptr<GameSession> titlesession;
65 };
66
67 #endif
68