Changeset 6417 for code/trunk/src/orxonox/gamestates/GSMainMenu.cc
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r6105 r6417 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 … … 92 97 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu")); 93 98 99 // create command to change sound path 100 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath")); 101 94 102 KeyBinderManager::getInstance().setToDefault(); 95 103 InputManager::getInstance().enterState("mainMenu"); 96 104 105 this->setConfigValues(); 106 97 107 if (GameMode::playsSound()) 98 108 { 99 this->ambient_->setLoop (true);100 this->ambient_->play(); 109 this->ambient_->setLooping(true); 110 this->ambient_->play(); // works without source 101 111 } 102 112 } … … 112 122 113 123 GUIManager::getInstance().setCamera(0); 124 GUIManager::getInstance().setBackground(""); 125 GUIManager::hideGUI("MainMenu"); 114 126 GraphicsManager::getInstance().setCamera(0); 115 127 } … … 117 129 void GSMainMenu::update(const Clock& time) 118 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); 119 156 } 120 157
Note: See TracChangeset
for help on using the changeset viewer.