BaseGameLogic *CometConquestGameApp::VCreateGameAndView() { BaseGameLogic *game = NULL; assert(m_pOptions && _T("The game options object is uninitialized.")); // Register any game-specific events here. RegisterGameSpecificEvents(); // Need to know if you are client or server before this point? if (m_pOptions->m_gameHost.empty()) { game = GCC_NEW CometConquestGame(*m_pOptions); } else { game = GCC_NEW CometConquestGame(*m_pOptions); //EventListenerPtr listener ( GCC_NEW NetworkEventForwarder( 0 ) ); //extern void ListenForCometConquestGameCommands(EventListenerPtr listener); //ListenForCometConquestGameCommands(listener); } shared_ptr<IGameView> menuView(GCC_NEW MainMenuView()); game->VAddView(menuView); return game; }
// ///////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////// shared_ptr<BaseGameLogic> Pool3dGame::VCreateLogicAndViews() { RegisterGameSpecificEvents(); // Create the logic layer for the test app. shared_ptr<BaseGameLogic> logicPtr(GCC_NEW Pool3dLogic(m_optionsPtr, m_loggerPtr, m_mvProjStackManager)); if(!logicPtr) { GF_LOG_FAT("Failed to allocate memory for the Pool3D logic layer"); } else { // TODO: Load the loading screen/view here first. // Add the main game view where gameplay is rendered. shared_ptr<Pool3dView> viewPtr(GCC_NEW Pool3dView(m_optionsPtr, m_loggerPtr, m_windowManagerPtr, m_mvProjStackManager, &m_viewFrustrum)); if(!viewPtr) { GF_LOG_FAT("Failed to allocate memory for the Pool3D view (Removing the Pool3D logic layer as a result)"); logicPtr.reset(); } else { boost::optional<GameViewId> gameViewId = logicPtr->VAddView(viewPtr); if(!gameViewId.is_initialized()) { GF_LOG_FAT("Failed to add the GameView to the Logic layer"); } else { m_gameId = *gameViewId; } } // Add the menu/UI view where the menu screens are displayed overlayed on the game view. shared_ptr<Pool3dMenuView> menuViewPtr(GCC_NEW Pool3dMenuView(m_optionsPtr, m_loggerPtr, m_windowManagerPtr, m_mvProjStackManager)); if(!menuViewPtr) { GF_LOG_FAT("Failed to allocate memory for the Pool3D UI/Menu view (Removing the Pool3D logic layer as a result)"); logicPtr.reset(); } else { boost::optional<GameViewId> uiViewId = logicPtr->VAddView(menuViewPtr); if(!uiViewId.is_initialized()) { GF_LOG_FAT("Failed to add the UiView to the Logic layer"); } else { m_uiId = *uiViewId; } } } return (logicPtr); }
shared_ptr<BaseGameLogic> TestApp::VCreateLogicAndViews() { RegisterGameSpecificEvents(); shared_ptr<BaseGameLogic> logicPtr(GCC_NEW TestLogic(m_optionsPtr , m_loggerPtr , m_mvProjStackManager)); shared_ptr<TestView> viewPtr(GCC_NEW TestView(m_optionsPtr , m_loggerPtr , m_windowManagerPtr , m_mvProjStackManager)); boost::optional<GameViewId> gameViewId = logicPtr->VAddView(viewPtr); m_gameId = *gameViewId; return (logicPtr); }