- Timestamp:
- Oct 14, 2009, 5:01:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/sound3/src/orxonox/gamestates/GSMainMenu.cc
r5929 r5956 36 36 #include "core/Game.h" 37 37 #include "core/ConsoleCommand.h" 38 #include "core/ConfigValueIncludes.h" 38 39 #include "core/GraphicsManager.h" 39 40 #include "core/GUIManager.h" … … 49 50 , inputState_(0) 50 51 { 52 RegisterRootObject(GSMainMenu); 51 53 inputState_ = InputManager::getInstance().createInputState("mainMenu"); 52 54 inputState_->setMouseMode(MouseMode::Nonexclusive); … … 64 66 // Load sound 65 67 this->ambient_ = new AmbientSound(0); 66 this->ambient_->setSource("ambient/mainmenu.wav");67 68 } 68 69 } … … 92 93 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu")); 93 94 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startIOConsole), "startIOConsole")); 95 96 // create command to change sound path 97 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath")); 94 98 95 99 KeyBinderManager::getInstance().setToDefault(); … … 99 103 { 100 104 this->ambient_->setLoop(true); 101 this->ambient_->play();105 this->ambient_->setPlayOnLoad(true); 102 106 } 107 108 this->setConfigValues(); 103 109 } 104 110 … … 119 125 { 120 126 } 127 128 void GSMainMenu::setConfigValues() 129 { 130 SetConfigValue(soundPathMain_, "ambient/mainmenu.wav") 131 .description("Contains the path to the main menu sound file.") 132 .callback(this, &GSMainMenu::reloadSound); 133 } 134 135 void GSMainMenu::reloadSound() { 136 if (GameMode::playsSound()) 137 { 138 this->ambient_->setSource(soundPathMain_); 139 } 140 } 141 142 const std::string& GSMainMenu::getMainMenuSoundPath() { 143 return soundPathMain_; 144 } 145 146 void GSMainMenu::setMainMenuSoundPath(const std::string& path) { 147 ModifyConfigValue(soundPathMain_, set, path); 148 } 121 149 122 150 void GSMainMenu::startStandalone()
Note: See TracChangeset
for help on using the changeset viewer.