Changeset 6117 for code/branches/presentation2/src/orxonox/gamestates
- Timestamp:
- Nov 22, 2009, 4:01:16 PM (15 years ago)
- Location:
- code/branches/presentation2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2
- Property svn:mergeinfo changed
/code/branches/sound3 (added) merged: 5941,5943,5946,5954,5956-5957,5962,5982,6031,6046,6069-6072,6074,6088,6093,6097,6100,6102
- Property svn:mergeinfo changed
-
code/branches/presentation2/src/orxonox/gamestates/GSMainMenu.cc
r6105 r6117 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 } … … 91 92 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startDedicated), "startDedicated")); 92 93 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu")); 94 95 // create command to change sound path 96 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath")); 93 97 94 98 KeyBinderManager::getInstance().setToDefault(); … … 97 101 if (GameMode::playsSound()) 98 102 { 99 this->ambient_->setLoop (true);100 this->ambient_->play(); 103 this->ambient_->setLooping(true); 104 this->ambient_->play(); // works without source 101 105 } 106 107 this->setConfigValues(); 102 108 } 103 109 … … 117 123 void GSMainMenu::update(const Clock& time) 118 124 { 125 } 126 127 void GSMainMenu::setConfigValues() 128 { 129 SetConfigValue(soundPathMain_, "mainmenu.ogg") 130 .description("Contains the path to the main menu sound file.") 131 .callback(this, &GSMainMenu::reloadSound); 132 } 133 134 void GSMainMenu::reloadSound() 135 { 136 if (GameMode::playsSound()) 137 { 138 this->ambient_->setAmbientSource(soundPathMain_); 139 } 140 } 141 142 const std::string& GSMainMenu::getMainMenuSoundPath() 143 { 144 return soundPathMain_; 145 } 146 147 void GSMainMenu::setMainMenuSoundPath(const std::string& path) 148 { 149 ModifyConfigValue(soundPathMain_, set, path); 119 150 } 120 151 -
code/branches/presentation2/src/orxonox/gamestates/GSMainMenu.h
r5929 r6117 34 34 #include "util/OgreForwardRefs.h" 35 35 #include "core/GameState.h" 36 #include "core/OrxonoxClass.h" 36 37 37 38 namespace orxonox 38 39 { 39 class _OrxonoxExport GSMainMenu : public GameState 40 class _OrxonoxExport GSMainMenu : public GameState, public OrxonoxClass 40 41 { 41 42 public: … … 46 47 void deactivate(); 47 48 void update(const Clock& time); 49 50 void setConfigValues(); 51 void reloadSound(); 52 const std::string& getMainMenuSoundPath(); 53 void setMainMenuSoundPath(const std::string& path); 48 54 49 55 static void startStandalone(); … … 61 67 // ambient sound for the main menu 62 68 AmbientSound* ambient_; 69 std::string soundPathMain_; 63 70 }; 64 71 }
Note: See TracChangeset
for help on using the changeset viewer.