当前位置: 首页>>代码示例>>C++>>正文


C++ RenderWindow::isVisible方法代码示例

本文整理汇总了C++中ogre::RenderWindow::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow::isVisible方法的具体用法?C++ RenderWindow::isVisible怎么用?C++ RenderWindow::isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::RenderWindow的用法示例。


在下文中一共展示了RenderWindow::isVisible方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: run

void ClientApplication::run()
{
    Ogre::Root* root = mGraphicsManager->getRoot();
    Ogre::RenderWindow* window = mGraphicsManager->getWindow();

    root->getRenderSystem()->_initRenderTargets();
    root->clearEventTimes();

    boost::timer timer;

    while( !mShutdown )
    {
        if( mShutdownRequested )
        {
            mStateMachine->popTo( 0 );
            mShutdown = true;
        }

        const Real elapsed = timer.elapsed();
        timer.restart();

        mEarlyUpdateSignal();
        mEarlyFrameSignal( elapsed );
        mUpdateSignal();
        mFrameSignal( elapsed );
        mLateUpdateSignal();
        mLateFrameSignal( elapsed );

        Ogre::WindowEventUtilities::messagePump();

        // Render even when the window is inactive.
        if( window->isActive() )
        {
            root->renderOneFrame();
        }
        else if( window->isVisible() )
        {
            root->renderOneFrame();
            window->update();

#if DIVERSIA_PLATFORM == DIVERSIA_PLATFORM_WIN32
            Sleep( ( 1.0 / 60.0 ) * 1000.0 );
#else
            usleep( ( 1.0 / 60.0 ) * 1000000.0 );
#endif
        }
        else if( !window->isActive() && !window->isVisible() )
        {
#if DIVERSIA_PLATFORM == DIVERSIA_PLATFORM_WIN32
            Sleep( ( 1.0 / 60.0 ) * 1000.0 );
#else
            usleep( ( 1.0 / 60.0 ) * 1000000.0 );
#endif
        }
    }
}
开发者ID:Gohla,项目名称:Diversia,代码行数:56,代码来源:ClientApplication.cpp

示例2: renderThreadApp

//---------------------------------------------------------------------
unsigned long renderThreadApp(Ogre::ThreadHandle* threadHandle) {
	LeDernierMorkid::LeDernierMorkidThreadData* threadData     = reinterpret_cast<LeDernierMorkid::LeDernierMorkidThreadData*>(threadHandle->getUserParam());
	GraphicsSystem*                             graphicsSystem = threadData->graphicsSystem;
	Ogre::Barrier*                              barrier        = threadData->barrier;

	graphicsSystem->initialize("Le Dernier Morkid");
	graphicsSystem->getInputHandler()->setGrabMousePointer(true);
	graphicsSystem->getInputHandler()->setMouseVisible(false);
	barrier->sync();

	if (graphicsSystem->getQuit()) {
		graphicsSystem->deinitialize();
		return 0; // User cancelled config
	}

	graphicsSystem->createScene();
	barrier->sync();

	Ogre::RenderWindow* renderWindow = graphicsSystem->getRenderWindow();

	Ogre::Timer   timer;
	unsigned long startTime     = timer.getMicroseconds();
	double        timeSinceLast = 1.0 / 60.0;

	while (!graphicsSystem->getQuit()) {
		graphicsSystem->beginFrameParallel();
		graphicsSystem->update(timeSinceLast);
		graphicsSystem->finishFrameParallel();

		if (!renderWindow->isVisible()) {
			// Don't burn CPU cycles unnecessary when we're minimized.
			Ogre::Threads::Sleep(500);
		}

		unsigned long endTime = timer.getMicroseconds();
		timeSinceLast         = (endTime - startTime) / 1000000.0;
		timeSinceLast         = std::min(1.0, timeSinceLast); // Prevent from going haywire.
		startTime             = endTime;
	}

	barrier->sync();

	graphicsSystem->destroyScene();
	barrier->sync();

	graphicsSystem->deinitialize();
	barrier->sync();

	return 0;
}
开发者ID:Swarthon,项目名称:LeDernierMorkid,代码行数:51,代码来源:GraphicsThread.cpp

示例3: main


//.........这里部分代码省略.........
		if (graphicsSystem)
			delete graphicsSystem;
		if (graphicsGameState)
			delete graphicsGameState;

		return 0; //User cancelled config
	}

	Ogre::RenderWindow *renderWindow = graphicsSystem->getRenderWindow();

	graphicsSystem->createScene01();
	if (logicSystem)
		logicSystem->createScene01();

	graphicsSystem->createScene02();
	if (logicSystem)
		logicSystem->createScene02();

#if OGRE_USE_SDL2
	//Do this after creating the scene for easier the debugging (the mouse doesn't hide itself)
	OGraphics::SdlInputHandler *inputHandler = graphicsSystem->getInputHandler();
	inputHandler->setGrabMousePointer(true);
	inputHandler->setMouseVisible(false);
#endif

	Ogre::Timer timer;
#if KYLE_TUTORIAL_GAME_LOOP 1
	unsigned long startTime = timer.getMicroseconds();
	double accumulator = OGraphics::FRAMETIME;
	double timeSinceLast = OGraphics::FRAMETIME;

	while (!graphicsSystem->getQuit())
	{
		while (accumulator >= OGraphics::FRAMETIME && logicSystem)
		{
			logicSystem->beginFrameParallel();
			logicSystem->update(static_cast<float>(OGraphics::FRAMETIME));
			logicSystem->finishFrameParallel();

			logicSystem->finishFrame();
			graphicsSystem->finishFrame();

			accumulator -= OGraphics::FRAMETIME;
		}

		graphicsSystem->beginFrameParallel();
		graphicsSystem->update(static_cast<float>(timeSinceLast));
		graphicsSystem->finishFrameParallel();
		if (!logicSystem)
			graphicsSystem->finishFrame();

		if (!renderWindow->isVisible())
		{
			//Don't burn CPU cycles unnecessary when we're minimized.
			Ogre::Threads::Sleep(500);
		}

		unsigned long endTime = timer.getMicroseconds();
		timeSinceLast = (endTime - startTime) / 1000000.0; // Presumably puts it in milliseconds
		timeSinceLast  = std::min(1.0, timeSinceLast); //Prevent from going haywire.
		accumulator += timeSinceLast;
		startTime = endTime;
	}
#else
	double dt = OGraphics::FRAMETIME;
	unsigned long startTime = timer.getMicroseconds();
	unsigned long nowTime = 0;
	while (!graphicsSystem->getQuit())
	{
		graphicsSystem->beginFrameParallel();
		graphicsSystem->update(static_cast<float>(dt));
		graphicsSystem->finishFrameParallel();
		// KYLE :: WHAT THE HELL IS THIS?
		if (!logicSystem)
			graphicsSystem->finishFrame();

		do {
			nowTime = timer.getMicroseconds();
			dt = ((nowTime - startTime) / 1000000.0);
			dt = std::min(1.0, dt);
		} while (dt < OGraphics::FRAMETIME);
		startTime = nowTime;
	}
#endif

	graphicsSystem->destroyScene();
	if (logicSystem)
	{
		logicSystem->destroyScene();
		logicSystem->deinitialize();
	}
	graphicsSystem->deinitialize();

	if (graphicsSystem)
		delete graphicsSystem;
	if (graphicsGameState)
		delete graphicsGameState;

	return 0;
}
开发者ID:fulletron,项目名称:BlockGame,代码行数:101,代码来源:main_OLD.cpp

示例4: mainApp

int mainApp()
#endif
{
    PbsMaterialsGameState pbsMaterialsGameState(
        "Shows how to use the PBS material system. There's nothing really fancy,\n"
        "it's just programmer art. The PBS materials can be setup from script or\n"
        "code. This sample does both. At the time being, not all settings from the\n"
        "PBS implementation can be tweaked with scripts. See PbsDatablock::PbsDatablock\n"
        "constructor documentation. Also see the Hlms section of the porting guide in\n"
        "the Docs/2.0 folder.\n"
        "\n"
        "The sphere palette shows what happens when tweaking the roughness around the\n"
        "X axis; and the fresnel term around the Z axis.\n"
        "The scene is being lit by a white directional light (3-split PSSM) and two spot\n"
        "lights, one of warm colour, one cold. Both are also shadowed."
        "\n"
        "Of all the features supported by the PBS implementation, perhaps the hardest to\n"
        "to understand is the Detail Weight Map. It allows you to 'paint' the detail maps\n"
        "over the mesh, by controlling weight of each of the 4 maps via the RGBA channels\n"
        "of the weight map. 'R' controls the detail map 0, 'G' the detail map 1,\n"
        "'B' the detail map 2, and 'A' the detail map 3.\n"
        "\n"
        "This sample depends on the media files:\n"
        "   * Samples/Media/2.0/scripts/Compositors/PbsMaterials.compositor\n"
        "   * Samples/Media/2.0/materials/PbsMaterials/PbsMaterials.material\n"
        "\n"
        "Known issues:\n"
        " * Non shadow casting point & spot lights require Forward3D to be enabled (on desktop).\n"
        "   This is by design (more implementations will come: Forward+ & Deferred; for now the\n"
        "   only one working is F3D).\n"
        " * Shadow casting point lights don't work or work poorly. (feature not implemented yet)\n"
        " * If PSSM shadow casting enabled, the system requires at least one shadow-casting\n"
        "   directional light (bug)\n"
        " * Mobile version only supports forward lighting.\n"
        "\n"
        "LEGAL: Uses Saint Peter's Basilica (C) by Emil Persson under CC Attrib 3.0 Unported\n"
        "See Samples/Media/materials/textures/Cubemaps/License.txt for more information.");
    PbsMaterialsGraphicsSystem graphicsSystem( &pbsMaterialsGameState );

    pbsMaterialsGameState._notifyGraphicsSystem( &graphicsSystem );

    graphicsSystem.initialize( "PBS Materials Sample" );

    if( graphicsSystem.getQuit() )
    {
        graphicsSystem.deinitialize();
        return 0; //User cancelled config
    }

    Ogre::RenderWindow *renderWindow = graphicsSystem.getRenderWindow();

    graphicsSystem.createScene01();
    graphicsSystem.createScene02();

	graphicsSystem.SetUpCustomContent();			// create my custom contents

    //Do this after creating the scene for easier the debugging (the mouse doesn't hide itself)
    SdlInputHandler *inputHandler = graphicsSystem.getInputHandler();
    inputHandler->setGrabMousePointer( true );
    inputHandler->setMouseVisible( false );

    Ogre::Timer timer;
    unsigned long startTime = timer.getMicroseconds();

    double timeSinceLast = 1.0 / 60.0;

    while( !graphicsSystem.getQuit() )
    {
		graphicsSystem.CustomUpdate();		// update my custom rtts
        graphicsSystem.beginFrameParallel();
        graphicsSystem.update( static_cast<float>( timeSinceLast ) );
        graphicsSystem.finishFrameParallel();
        graphicsSystem.finishFrame();

        if( !renderWindow->isVisible() )
        {
            //Don't burn CPU cycles unnecessary when we're minimized.
            Ogre::Threads::Sleep( 500 );
        }

        unsigned long endTime = timer.getMicroseconds();
        timeSinceLast = (endTime - startTime) / 1000000.0;
        timeSinceLast = std::min( 1.0, timeSinceLast ); //Prevent from going haywire.
        startTime = endTime;
    }

    graphicsSystem.destroyScene();
    graphicsSystem.deinitialize();

    return 0;
}
开发者ID:lygyue,项目名称:Sample_PbsMaterials,代码行数:91,代码来源:PbsMaterials.cpp

示例5: EnterMainLoop

void Main::EnterMainLoop()
{
	/* Setup 3D engine */
	OgreSubsystem* ror_ogre_subsystem = RoR::Application::GetOgreSubsystem();
	assert(ror_ogre_subsystem != nullptr);
	m_viewport = ror_ogre_subsystem->GetRenderWindow()->addViewport(nullptr);
	int viewport_width = m_viewport->getActualWidth();
	m_viewport->setBackgroundColour(m_config->viewport_background_color);
	m_camera->setAspectRatio(m_viewport->getActualHeight() / viewport_width);
	m_viewport->setCamera(m_camera);

	InitializeOrRestoreGui();

	/* Setup input */
	RoR::Application::GetInputEngine()->SetKeyboardListener(m_input_handler);
	RoR::Application::GetInputEngine()->SetMouseListener(m_input_handler);

	/* Show debug box */
	m_debug_box->setVisible(true);

	while (! m_exit_loop_requested)
	{
		UpdateMainLoop();

		Ogre::RenderWindow* rw = RoR::Application::GetOgreSubsystem()->GetRenderWindow();
		if (rw->isClosed())
		{
			RoR::Application::GetMainThreadLogic()->RequestShutdown();
			break;
		}

		/* Render */
		RoR::Application::GetOgreSubsystem()->GetOgreRoot()->renderOneFrame();

		if (!rw->isActive() && rw->isVisible())
		{
			rw->update(); // update even when in background !
		}
	}

	/* Hide GUI */
	m_gui_menubar->Hide();
	if (m_gui_open_save_file_dialog->isModal())
	{
		m_gui_open_save_file_dialog->endModal(); // Hides the dialog
	}
	m_gui_delete_menu->Hide();
	// Supress node/beam panels (if visible)
	m_nodes_panel    ->HideTemporarily();
	m_beams_panel    ->HideTemporarily();
	m_hydros_panel   ->HideTemporarily();
	m_commands2_panel->HideTemporarily();
	m_shocks_panel   ->HideTemporarily();
	m_shocks2_panel  ->HideTemporarily();
    m_meshwheels2_panel     ->HideTemporarily();
    m_flexbodywheels_panel  ->HideTemporarily();

	/* Hide debug box */
	m_debug_box->setVisible(false);

	m_exit_loop_requested = false;
}
开发者ID:Bob-Z,项目名称:rigs-of-rods,代码行数:62,代码来源:RigEditor_Main.cpp


注:本文中的ogre::RenderWindow::isVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。