00001 // $Id: screen_manager.cxx,v 1.3 2003/01/11 19:07:48 grumbel Exp $ 00002 // 00003 // Construo - A wire-frame construction gamee 00004 // Copyright (C) 2002 Ingo Ruhnke <[email protected]> 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 #include "load_gui_manager.hxx" 00021 #include "save_gui_manager.hxx" 00022 #include "world_gui_manager.hxx" 00023 #include "screen_manager.hxx" 00024 00025 ScreenManager* ScreenManager::instance_ = 0; 00026 00027 ScreenManager::ScreenManager () 00028 : do_quit(false) 00029 { 00030 load_gui_manager = new LoadGUIManager(); 00031 save_gui_manager = new SaveGUIManager(); 00032 world_gui_manager = new WorldGUIManager(); 00033 00034 current_gui_manager = world_gui_manager; 00035 } 00036 00037 void 00038 ScreenManager::run_once () 00039 { 00040 current_gui_manager->run_once (); 00041 } 00042 00043 bool 00044 ScreenManager::is_finished () 00045 { 00046 return do_quit; 00047 } 00048 00049 void 00050 ScreenManager::quit() 00051 { 00052 do_quit = true; 00053 } 00054 00055 void 00056 ScreenManager::set_gui (int gui_id) 00057 { 00058 switch (gui_id) 00059 { 00060 case WORLD_GUI: 00061 current_gui_manager = world_gui_manager; 00062 break; 00063 case LOAD_GUI: 00064 current_gui_manager = load_gui_manager; 00065 break; 00066 case SAVE_GUI: 00067 current_gui_manager = save_gui_manager; 00068 break; 00069 } 00070 } 00071 00072 ScreenManager* 00073 ScreenManager::instance () 00074 { 00075 if (instance_ == 0) 00076 return (instance_ = new ScreenManager ()); 00077 else 00078 return instance_; 00079 } 00080 00081 /* EOF */