void WinState::Enter() { m_scene_manager = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); m_camera = m_scene_manager->createCamera("IntroCamera"); m_viewport = m_render_window->addViewport(m_camera); m_camera->setAspectRatio(Ogre::Real(m_viewport->getActualWidth()) / Ogre::Real(m_viewport->getActualHeight())); m_viewport->setBackgroundColour(Ogre::ColourValue::White); std::function<void()> func = [this] { m_run_timer = true; m_allow_input = true; }; m_fade->SetFadeInCallBack(func); func = [this] { ChangeToMenuState(); }; m_fade->SetFadeOutCallBack(func); m_fade->FadeIn(VariableManager::GetSingletonPtr()->GetAsFloat("Fade_in_timer")); m_run_timer = false; m_allow_input = false; m_timer = 0.0f; m_target_time = 5.0f; m_bg = Ogre::OverlayManager::getSingleton().getByName("IntroLogo"); m_bg->show(); }
/** * * This function clears the renderer's buffers * * @author Daniel Jay * @param _hInstance The red component of the colour * @param _hWnd The green component of the colour * @param _iWidth The blue component of the colour * @param _iHeight The blue component of the colour * @param _bFullscreen The blue component of the colour * @return The success or failure of the initialisation * */ bool CTotalCubeDomination::Initialise(HINSTANCE _hInstance, HWND _hWnd, int32 _iWidth, int32 _iHeight, bool _bFullscreen) { m_hApplicationInstance = _hInstance; m_hMainWindow = _hWnd; #ifdef _DEBUG for (int32 i = 0; i < LOG_MESSAGE_MAX; ++i) { m_apLogManager[i] = new CLogManager; } { CLogFile* pLogFile = new CLogFile; pLogFile->Initialise("init.log"); m_apLogManager[LOG_MESSAGE_INIT]->AddLogTarget(pLogFile); CLogDebugOutput* pOutput = new CLogDebugOutput; m_apLogManager[LOG_MESSAGE_INIT]->AddLogTarget(pOutput); pLogFile = new CLogFile; pLogFile->Initialise("paths.log"); m_apLogManager[LOG_MESSAGE_PATHS]->AddLogTarget(pLogFile); pOutput = new CLogDebugOutput; m_apLogManager[LOG_MESSAGE_PATHS]->AddLogTarget(pOutput); pLogFile = new CLogFile; pLogFile->Initialise("sound.log"); m_apLogManager[LOG_MESSAGE_SOUND]->AddLogTarget(pLogFile); pOutput = new CLogDebugOutput; m_apLogManager[LOG_MESSAGE_SOUND]->AddLogTarget(pOutput); //pLogFile = new CLogFile; //pLogFile->Initialise("tower.log"); //m_apLogManager[LOG_MESSAGE_TOWER]->AddLogTarget(pLogFile); pOutput = new CLogDebugOutput; m_apLogManager[LOG_MESSAGE_OUTPUT]->AddLogTarget(pOutput); // Test harness logging file. pLogFile = new CLogFile; pLogFile->Initialise("tests.log"); m_apLogManager[LOG_MESSAGE_TEST]->AddLogTarget(pLogFile); } #endif // _DEBUG m_pClock = new CPerformanceClock; if (!m_pClock->Initialise()) { #ifdef _DEBUG LogMessage("Performance counter failed, using system clock", LOG_MESSAGE_INIT); #endif // _DEBUG m_pClock = new CSystemClock; } VALIDATE(m_pClock->Initialise()); m_pClock->Process(); m_pRenderer = new CRenderer; VALIDATE(m_pRenderer->Initialise(_hWnd, _iWidth, _iHeight, _bFullscreen)); m_pRenderer->SetClearColour(0.0f, 0.0f, 0.0f); D3DMATERIAL9 material; ZeroMemory(&material, sizeof(material) ); material.Ambient.a = 1.0f; material.Ambient.g = 1.0f; material.Ambient.r = 1.0f; material.Ambient.b = 1.0f; m_pRenderer->GetDevice()->SetMaterial(&material); VALIDATE(CInputHandler::GetInstance().Initialise(m_hApplicationInstance, m_hMainWindow)); CreateLoadingScreen(); ChangeToMenuState(); //SetProgramState(new CMenuState); ShowCursor(false); #ifdef _DEBUG /*// Instantiate test harness manager. m_pTestManager = new CTestManager(); //Set up m_pTestManager->SetUp(); //Run tests m_pTestManager->RunTest(); //Tear down m_pTestManager->TearDown(); delete m_pTestManager; m_pTestManager = 0;*/ #endif // _DEBUG #ifdef _DEBUG LogMessage("Initialisation successful", LOG_MESSAGE_INIT); #endif // _DEBUG return (true); }