- Timestamp:
- Dec 25, 2009, 1:18:03 PM (15 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/orxonox/gamestates/GSMainMenu.cc
r5929 r6412 36 36 #include "core/Game.h" 37 37 #include "core/ConsoleCommand.h" 38 #include "core/ConfigValueIncludes.h" 39 #include "core/CoreIncludes.h" 38 40 #include "core/GraphicsManager.h" 39 41 #include "core/GUIManager.h" … … 49 51 , inputState_(0) 50 52 { 53 RegisterRootObject(GSMainMenu); 51 54 inputState_ = InputManager::getInstance().createInputState("mainMenu"); 52 55 inputState_->setMouseMode(MouseMode::Nonexclusive); … … 64 67 // Load sound 65 68 this->ambient_ = new AmbientSound(0); 66 this->ambient_->setS ource("ambient/mainmenu.wav");69 this->ambient_->setSyncMode(0x0); 67 70 } 68 71 } … … 71 74 { 72 75 if (GameMode::playsSound()) 73 delete this->ambient_;76 this->ambient_->destroy(); 74 77 75 78 InputManager::getInstance().destroyState("mainMenu"); … … 82 85 { 83 86 // show main menu 84 GUIManager::getInstance().showGUI("MainMenu" );87 GUIManager::getInstance().showGUI("MainMenu", true, GraphicsManager::getInstance().isFullScreen()); 85 88 GUIManager::getInstance().setCamera(this->camera_); 89 GUIManager::getInstance().setBackground("MainMenuBackground"); 90 // GUIManager::getInstance().setBackground(""); 86 91 GraphicsManager::getInstance().setCamera(this->camera_); 87 92 … … 91 96 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startDedicated), "startDedicated")); 92 97 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu")); 93 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startIOConsole), "startIOConsole")); 98 99 // create command to change sound path 100 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath")); 94 101 95 102 KeyBinderManager::getInstance().setToDefault(); 96 103 InputManager::getInstance().enterState("mainMenu"); 97 104 105 this->setConfigValues(); 106 98 107 if (GameMode::playsSound()) 99 108 { 100 this->ambient_->setLoop (true);101 this->ambient_->play(); 109 this->ambient_->setLooping(true); 110 this->ambient_->play(); // works without source 102 111 } 103 112 } … … 113 122 114 123 GUIManager::getInstance().setCamera(0); 124 GUIManager::getInstance().setBackground(""); 125 GUIManager::hideGUI("MainMenu"); 115 126 GraphicsManager::getInstance().setCamera(0); 116 127 } … … 118 129 void GSMainMenu::update(const Clock& time) 119 130 { 131 } 132 133 void GSMainMenu::setConfigValues() 134 { 135 SetConfigValue(soundPathMain_, "mainmenu.ogg") 136 .description("Contains the path to the main menu sound file.") 137 .callback(this, &GSMainMenu::reloadSound); 138 } 139 140 void GSMainMenu::reloadSound() 141 { 142 if (GameMode::playsSound()) 143 { 144 this->ambient_->setAmbientSource(soundPathMain_); 145 } 146 } 147 148 const std::string& GSMainMenu::getMainMenuSoundPath() 149 { 150 return soundPathMain_; 151 } 152 153 void GSMainMenu::setMainMenuSoundPath(const std::string& path) 154 { 155 ModifyConfigValue(soundPathMain_, set, path); 120 156 } 121 157 … … 146 182 Game::getInstance().popState(); 147 183 Game::getInstance().popState(); 148 Game::getInstance().requestStates(" dedicated, level");184 Game::getInstance().requestStates("server, level"); 149 185 } 150 186 void GSMainMenu::startMainMenu() … … 155 191 Game::getInstance().requestStates("mainmenu"); 156 192 } 157 void GSMainMenu::startIOConsole()158 {159 // HACK - HACK160 Game::getInstance().popState();161 Game::getInstance().popState();162 Game::getInstance().requestStates("ioConsole");163 }164 193 }
Note: See TracChangeset
for help on using the changeset viewer.