1 // Construo - A wire-frame construction gamee 2 // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de> 3 // 4 // This program is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program. If not, see <http://www.gnu.org/licenses/>. 16 17 #include "load_gui_manager.hpp" 18 #include "save_gui_manager.hpp" 19 #include "world_gui_manager.hpp" 20 #include "screen_manager.hpp" 21 22 ScreenManager* ScreenManager::instance_ = 0; 23 ScreenManager()24ScreenManager::ScreenManager () 25 : do_quit(false) 26 { 27 load_gui_manager = new LoadGUIManager(); 28 save_gui_manager = new SaveGUIManager(); 29 world_gui_manager = new WorldGUIManager(); 30 31 current_gui_manager = world_gui_manager; 32 } 33 34 void run_once()35ScreenManager::run_once () 36 { 37 current_gui_manager->run_once (); 38 } 39 40 bool is_finished()41ScreenManager::is_finished () 42 { 43 return do_quit; 44 } 45 46 void quit()47ScreenManager::quit() 48 { 49 do_quit = true; 50 } 51 52 void set_gui(int gui_id)53ScreenManager::set_gui (int gui_id) 54 { 55 switch (gui_id) 56 { 57 case WORLD_GUI: 58 current_gui_manager = world_gui_manager; 59 break; 60 case LOAD_GUI: 61 current_gui_manager = load_gui_manager; 62 break; 63 case SAVE_GUI: 64 current_gui_manager = save_gui_manager; 65 break; 66 } 67 } 68 69 ScreenManager* instance()70ScreenManager::instance () 71 { 72 if (instance_ == 0) 73 return (instance_ = new ScreenManager ()); 74 else 75 return instance_; 76 } 77 78 /* EOF */ 79