Changeset 2850 for code/branches/gui/src/orxonox/gamestates/GSMainMenu.cc
- Timestamp:
- Mar 25, 2009, 11:53:04 PM (16 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gamestates/GSMainMenu.cc
r2848 r2850 28 28 29 29 #include "OrxonoxStableHeaders.h" 30 #include "GS GUI.h"30 #include "GSMainMenu.h" 31 31 32 #include <OgreViewport.h> 32 //#include <OgreViewport.h> 33 #include <OgreSceneManager.h> 33 34 #include "core/Clock.h" 34 35 #include "core/ConsoleCommand.h" … … 37 38 #include "core/input/SimpleInputState.h" 38 39 #include "gui/GUIManager.h" 40 #include "objects/Scene.h" 39 41 #include "GraphicsManager.h" 40 42 41 43 namespace orxonox 42 44 { 43 AddGameState(GS GUI, "mainMenu");45 AddGameState(GSMainMenu, "mainMenu"); 44 46 45 GS GUI::GSGUI(const std::string& name)47 GSMainMenu::GSMainMenu(const std::string& name) 46 48 : GameState(name) 49 , inputState_(0) 47 50 { 48 51 } 49 52 50 GS GUI::~GSGUI()53 GSMainMenu::~GSMainMenu() 51 54 { 52 55 } 53 56 54 void GS GUI::activate()57 void GSMainMenu::activate() 55 58 { 56 guiManager_ = GUIManager::getInstancePtr(); 59 inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("mainMenu"); 60 inputState_->setHandler(GUIManager::getInstancePtr()); 61 inputState_->setJoyStickHandler(&InputManager::EMPTY_HANDLER); 62 63 // create an empty Scene 64 this->scene_ = new Scene(0); 65 // and a Camera 66 this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera"); 57 67 58 68 // show main menu 59 //guiManager_->loadScene("MainMenu");60 guiManager_->showGUI("MainMenu", 0);61 GraphicsManager::getInstance(). getViewport()->setCamera(guiManager_->getCamera());69 GUIManager::getInstance().showGUI("mainMenu"); 70 GUIManager::getInstance().setCamera(this->camera_); 71 GraphicsManager::getInstance().setCamera(this->camera_); 62 72 63 73 { 64 // time factor console command 65 FunctorMember<GSGUI>* functor = createFunctor(&GSGUI::startGame); 74 FunctorMember<GSMainMenu>* functor = createFunctor(&GSMainMenu::startGame); 66 75 functor->setObject(this); 67 76 this->ccStartGame_ = createConsoleCommand(functor, "startGame"); 68 77 CommandExecutor::addConsoleCommandShortcut(this->ccStartGame_); 69 78 } 79 80 InputManager::getInstance().requestEnterState("mainMenu"); 70 81 } 71 82 72 void GS GUI::deactivate()83 void GSMainMenu::deactivate() 73 84 { 85 InputManager::getInstance().requestLeaveState("game"); 86 InputManager::getInstance().requestDestroyState("game"); 87 74 88 if (this->ccStartGame_) 75 89 { … … 78 92 } 79 93 80 guiManager_->hideGUI();94 GUIManager::getInstance().executeCode("hideGUI()"); 81 95 } 82 96 83 void GS GUI::update(const Clock& time)97 void GSMainMenu::update(const Clock& time) 84 98 { 85 // tick CEGUI86 guiManager_->update(time);87 99 } 88 100 89 void GS GUI::startGame()101 void GSMainMenu::startGame() 90 102 { 91 103 // HACK - HACK 92 104 Game::getInstance().popState(); 93 Game::getInstance().requestState("standalone"); 94 Game::getInstance().requestState("level"); 105 Game::getInstance().requestStates("standalone, level"); 95 106 } 96 107 }
Note: See TracChangeset
for help on using the changeset viewer.