1 // $Id: controller.hxx,v 1.6 2003/01/10 20:44:09 grumbel Exp $
3 // Construo - A wire-frame construction game
4 // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
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.
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.
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 02111-1307, USA.
20 #ifndef HEADER_CONSTRUO_CONTROLLER_HXX
21 #define HEADER_CONSTRUO_CONTROLLER_HXX
24 #include "delta_manager.hxx"
26 /** Holds all the different World states, handles undo and things like that */
30 std::vector
<World
*> undo_world_stack
;
31 std::vector
<World
*> redo_world_stack
;
38 /** The current active world, don't delete this, delet is handled in
42 DeltaManager delta_manager
;
44 static Controller
* instance_
;
46 /** Create an empty world workspace */
48 Controller (const std::string
& filename
);
51 static inline Controller
* instance() { return instance_
; }
53 bool has_been_run () { return world
&& world
->get_has_been_run (); }
55 bool is_running () { return running
; }
56 bool slow_down_active () { return slow_down
; }
57 void set_slow_down (bool s
) { slow_down
= s
; }
59 void set_action_cam(bool);
60 bool get_action_cam();
62 void set_hide_dots (bool);
63 bool get_hide_dots ();
65 World
* get_world () { assert(world
); return world
; }
67 /** Load a world by name, name is relative to the construo user directory */
68 void load_world (const std::string
& name
);
70 /** Save a world by name, name is relative to the construo user directory */
71 void save_world (const std::string
& name
);
73 std::string
get_slot_filename(int n
);
74 void save_to_slot (int n
);
75 void load_from_slot (int n
);
77 /** Updates the state of the controller and also the world */
85 /** Push the current world to the undo stack */
88 /** start or stops the simulation */
89 void start_simulation ();