Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

controller.hxx

Go to the documentation of this file.
00001 //  $Id: controller.hxx,v 1.6 2003/01/10 20:44:09 grumbel Exp $
00002 // 
00003 //  Construo - A wire-frame construction game
00004 //  Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 // 
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #ifndef HEADER_CONSTRUO_CONTROLLER_HXX
00021 #define HEADER_CONSTRUO_CONTROLLER_HXX
00022 
00023 #include "world.hxx"
00024 #include "delta_manager.hxx"
00025 
00027 class Controller
00028 {
00029 private:
00030   std::vector<World*> undo_world_stack;
00031   std::vector<World*> redo_world_stack;
00032 
00033   bool running;
00034   bool slow_down;
00035   bool action_cam;
00036   bool hide_dots;
00037 
00040   World* world;
00041 
00042   DeltaManager delta_manager;
00043   
00044   static Controller* instance_;
00045 public:
00047   Controller ();
00048   Controller (const std::string& filename);
00049   ~Controller ();
00050 
00051   static inline Controller* instance() { return instance_; }
00052 
00053   bool has_been_run () { return world && world->get_has_been_run (); }
00054   
00055   bool is_running () { return running; }
00056   bool slow_down_active () { return slow_down; }
00057   void set_slow_down (bool s) { slow_down = s; }
00058 
00059   void set_action_cam(bool);
00060   bool get_action_cam();
00061 
00062   void set_hide_dots (bool);
00063   bool get_hide_dots ();
00064 
00065   World* get_world () { assert(world); return world; }
00066 
00068   void load_world (const std::string& name);
00069 
00071   void save_world (const std::string& name);
00072 
00073   std::string get_slot_filename(int n);
00074   void save_to_slot (int n);
00075   void load_from_slot (int n);
00076 
00078   void update ();
00079 
00080   void clear_world ();
00081 
00082   void undo ();
00083   void redo ();
00084 
00086   void push_undo();
00087 
00089   void start_simulation ();
00090 };
00091 
00092 #endif
00093 
00094 /* EOF */

Generated on Thu Jul 24 10:24:29 2003 for Construo by doxygen1.3-rc3