Changeset 7219 for code/branches/consolecommands3/src/orxonox/gamestates
- Timestamp:
- Aug 26, 2010, 12:09:12 AM (15 years ago)
- Location:
- code/branches/consolecommands3/src/orxonox/gamestates
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/orxonox/gamestates/GSMainMenu.cc
r7204 r7219 48 48 DeclareGameState(GSMainMenu, "mainMenu", false, true); 49 49 50 static const std::string __CC_startStandalone_name = "startGame"; 51 static const std::string __CC_startServer_name = "startServer"; 52 static const std::string __CC_startClient_name = "startClient"; 53 static const std::string __CC_startDedicated_name = "startDedicated"; 54 static const std::string __CC_startMainMenu_name = "startMainMenu"; 55 static const std::string __CC_setMainMenuSoundPath_name = "setMMSoundPath"; 56 57 _SetConsoleCommand(__CC_startStandalone_name, &GSMainMenu::startStandalone).deactivate(); 58 _SetConsoleCommand(__CC_startServer_name, &GSMainMenu::startServer ).deactivate(); 59 _SetConsoleCommand(__CC_startClient_name, &GSMainMenu::startClient ).deactivate(); 60 _SetConsoleCommand(__CC_startDedicated_name, &GSMainMenu::startDedicated ).deactivate(); 61 _SetConsoleCommand(__CC_startMainMenu_name, &GSMainMenu::startMainMenu ).deactivate(); 62 _SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath); 63 50 64 GSMainMenu::GSMainMenu(const GameStateInfo& info) 51 65 : GameState(info) … … 89 103 InputManager::getInstance().enterState("MainMenuHackery"); 90 104 91 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startStandalone), "startGame")); 92 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startServer), "startServer")); 93 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startClient), "startClient")); 94 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startDedicated), "startDedicated")); 95 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu")); 96 97 // create command to change sound path 98 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath")); 105 _ModifyConsoleCommand(__CC_startStandalone_name).activate(); 106 _ModifyConsoleCommand(__CC_startServer_name ).activate(); 107 _ModifyConsoleCommand(__CC_startClient_name ).activate(); 108 _ModifyConsoleCommand(__CC_startDedicated_name ).activate(); 109 _ModifyConsoleCommand(__CC_startMainMenu_name ).activate(); 110 _ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(this); 99 111 100 112 KeyBinderManager::getInstance().setToDefault(); … … 122 134 GUIManager::hideGUI("MainMenu"); 123 135 GraphicsManager::getInstance().setCamera(0); 136 137 _ModifyConsoleCommand(__CC_startStandalone_name).deactivate(); 138 _ModifyConsoleCommand(__CC_startServer_name ).deactivate(); 139 _ModifyConsoleCommand(__CC_startClient_name ).deactivate(); 140 _ModifyConsoleCommand(__CC_startDedicated_name ).deactivate(); 141 _ModifyConsoleCommand(__CC_startMainMenu_name ).deactivate(); 142 _ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(0); 124 143 } 125 144 -
code/branches/consolecommands3/src/orxonox/gamestates/GSRoot.cc
r7204 r7219 41 41 { 42 42 DeclareGameState(GSRoot, "root", false, false); 43 SetConsoleCommandShortcut(GSRoot, printObjects); 43 44 static const std::string __CC_setTimeFactor_name = "setTimeFactor"; 45 static const std::string __CC_pause_name = "pause"; 46 47 _SetConsoleCommand("printObjects", &GSRoot::printObjects); 48 _SetConsoleCommand(__CC_setTimeFactor_name, &GSRoot::setTimeFactor).accessLevel(AccessLevel::Master).defaultValues(1.0); 49 _SetConsoleCommand(__CC_pause_name, &GSRoot::pause ).accessLevel(AccessLevel::Master); 44 50 45 51 registerStaticNetworkFunction(&TimeFactorListener::setTimeFactor); … … 76 82 TimeFactorListener::setTimeFactor(1.0f); 77 83 78 // time factor console command 79 ConsoleCommand* command = createConsoleCommand(createFunctor(&GSRoot::setTimeFactor, this), "setTimeFactor"); 80 CommandExecutor::addConsoleCommandShortcut(command).accessLevel(AccessLevel::Offline).defaultValue(0, 1.0); 81 82 // time factor console command 83 command = createConsoleCommand(createFunctor(&GSRoot::pause, this), "pause"); 84 CommandExecutor::addConsoleCommandShortcut(command).accessLevel(AccessLevel::Offline); 84 _ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(this); 85 _ModifyConsoleCommand(__CC_pause_name).setObject(this); 85 86 } 86 87 87 88 void GSRoot::deactivate() 88 89 { 90 _ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(0); 91 _ModifyConsoleCommand(__CC_pause_name).setObject(0); 89 92 } 90 93
Note: See TracChangeset
for help on using the changeset viewer.