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


C++ IrrlichtDevice::drop方法代码示例

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


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

示例1: main

int main()
{
    //创建设备,颜色深度16,
    IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(640, 480), 16,
                 false/*不全屏*/, false/*关闭stencil buffer*/, false/*不与视频同步*/, 0);

    if (!device)
        return 1;

    device->setWindowCaption(L"不停变化的背景色");

    IVideoDriver* driver = device->getVideoDriver();

    f32 bg_r = 255.0f;
    f32 bg_g = 255.0f;
    f32 bg_b = 255.0f;

    bool fadeOut = true;

    int lastFPS = -1;

    u32 then = device->getTimer()->getTime();

    const f32 fadeRate = 0.1f;

    while(device->run())
    {
        const u32 now = device->getTimer()->getTime();
        const f32 frameDeltaTime = (f32)(now - then);
        then = now;

        if (bg_r <= 0.0f) fadeOut = false;
        else if (bg_r >= 255.0f) fadeOut = true;

        if (fadeOut)
        {
            bg_r-= fadeRate * frameDeltaTime;
            bg_g-= fadeRate * frameDeltaTime;
            bg_b-= fadeRate * frameDeltaTime;
        }
        else
        {
            bg_r+= fadeRate * frameDeltaTime;
            bg_g+= fadeRate * frameDeltaTime;
            bg_b+= fadeRate * frameDeltaTime;
        }

        driver->beginScene(true, true, SColor(255, (u32)bg_r, (u32)bg_g, (u32)bg_b));

        driver->endScene();
    }

    device->drop();

    return 0;
}
开发者ID:fuyajun1983cn,项目名称:myplayground,代码行数:56,代码来源:main.cpp

示例2: drawLine

// this test draws lines of different lengths and compares
// them with pixel placement
// grey pixels denote start and end of the white drawn lines
// black pixels only make those grey points better visible
// yellow and magenta lines should start and end next toa black pixel,
// yellow one right to the last black pixel down, magenta below the last
// black pixel to the right
// white lines are always double drawn, lines back and forth.
static bool drawLine(E_DRIVER_TYPE driverType)
{
	IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
	if (!device)
		return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs

	IVideoDriver* driver = device->getVideoDriver();

	stabilizeScreenBackground(driver);

	logTestString("Testing driver %ls\n", driver->getName());

	device->getSceneManager()->addCameraSceneNode();

	driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140));
	// horizontal lines
	for (u32 i=0; i<20; ++i)
	{
		driver->draw2DLine(core::vector2di(10,10+3*i), core::vector2di(10+2*i,10+3*i));
		// mark start point
		driver->drawPixel(9,10+3*i+1, video::SColor(0xff000000));
		driver->drawPixel(10,10+3*i+1, video::SColor(0xff888888));
		driver->drawPixel(11,10+3*i+1, video::SColor(0xff000000));
		// mark end point
		driver->drawPixel(9+2*i,10+3*i+1, video::SColor(0xff000000));
		driver->drawPixel(10+2*i,10+3*i+1, video::SColor(0xff888888));
		driver->drawPixel(11+2*i,10+3*i+1, video::SColor(0xff000000));
		driver->draw2DLine(core::vector2di(10+2*i,10+3*i+2), core::vector2di(10,10+3*i+2));
	}
	// vertical lines
	for (u32 i=0; i<20; ++i)
	{
		driver->draw2DLine(core::vector2di(11+3*i,10), core::vector2di(11+3*i,10+2*i));
		// mark start point
		driver->drawPixel(11+3*i+1,9, video::SColor(0xff000000));
		driver->drawPixel(11+3*i+1,10, video::SColor(0xff888888));
		driver->drawPixel(11+3*i+1,11, video::SColor(0xff000000));
		// mark end point
		driver->drawPixel(11+3*i+1,9+2*i, video::SColor(0xff000000));
		driver->drawPixel(11+3*i+1,10+2*i, video::SColor(0xff888888));
		driver->drawPixel(11+3*i+1,11+2*i, video::SColor(0xff000000));
		driver->draw2DLine(core::vector2di(11+3*i+2,10+2*i), core::vector2di(11+3*i+2, 10));
	}
	// diagonal lines
	driver->draw2DLine(core::vector2di(14,14),core::vector2di(50,68), video::SColor(0xffffff00));
	driver->draw2DLine(core::vector2di(15,14),core::vector2di(69,50), video::SColor(0xffff00ff));
	driver->endScene();

	bool result = takeScreenshotAndCompareAgainstReference(driver, "-drawLine.png");

	device->closeDevice();
	device->run();
	device->drop();

	return result;
}
开发者ID:vgck,项目名称:irrnacht,代码行数:64,代码来源:drawPixel.cpp

示例3: main

/*
That's it. The Scene node is done. Now we simply have to start
the engine, create the scene node and a camera, and look at the result.
*/
int main()
{
	// create engine and camera

	IrrlichtDevice *device =
		createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480), 16, false);

	device->setWindowCaption(L"Custom Scene Node - Irrlicht Engine Demo");

	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();

	smgr->addCameraSceneNode(0, core::vector3df(0,-40,0), core::vector3df(0,0,0));

	/*
	Create our scene node. Note that it is dropped (->drop()) instantly after 
	we create it. This is possible because the scene manager now takes
	care of it. This is not nessecary, it would also be possible to drop it
	at the end of the program.
	*/

	CSampleSceneNode *myNode = 
		new CSampleSceneNode(smgr->getRootSceneNode(), smgr, 666);

	myNode->drop();

	/*
	To animate something in this boring scene consisting only of one tetraeder,
	and to show, that you now can use your scene node like any other scene
	node in the engine, we add an animator to the scene node, which rotates
	the node a little bit.
	*/

	scene::ISceneNodeAnimator* anim = 
		smgr->createRotationAnimator(core::vector3df(0.8f, 0, 0.8f));

	myNode->addAnimator(anim);
	anim->drop();

	/* 
	Now draw everything and finish.
	*/

	while(device->run())
	{
		driver->beginScene(true, true, video::SColor(0,100,100,100));

		smgr->drawAll();

		driver->endScene();
	}

	device->drop();
	
	return 0;
}
开发者ID:RaymondLiao,项目名称:elektronika,代码行数:60,代码来源:main.cpp

示例4: main

int main( ) {
	// Boring stuff: set up the scene, object & camera as usual
	IrrlichtDevice* device = createDevice( DRIVER, dimension2d<s32>( 640, 480 ), 16, false, false, false, 0 );
	IVideoDriver* driver = device->getVideoDriver( );
	ISceneManager* smgr = device->getSceneManager( );
	IGUIEnvironment* guienv = device->getGUIEnvironment( );
	device->getFileSystem( )->changeWorkingDirectoryTo( MEDIA_DIRECTORY );
	guienv->addStaticText( L"Lens Flare", rect<s32>( 10, 10, 260, 22 ), true );
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( smgr->getMesh( "sydney.md2" ) );
	node->setMaterialFlag( EMF_LIGHTING, false );
	node->setMD2Animation( scene::EMAT_STAND );
	node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
	IAnimatedMeshSceneNode* node2 = smgr->addAnimatedMeshSceneNode( smgr->getMesh( "sydney.md2" ) );
	node2->setMaterialFlag( EMF_LIGHTING, false );
	node2->setMD2Animation( scene::EMAT_STAND );
	node2->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
	node2->setPosition( vector3df( 20.0f, 0.0f, 0.0f ) );
	ICameraSceneNode* cam = smgr->addCameraSceneNode( 0, vector3df( 40.0f, 30.0f, -40.0f ), vector3df( 0.0f, 5.0f, 0.0f ) );

	ISceneNode* sun = smgr->addSphereSceneNode( 50.0f, 16 );
	sun->setPosition( vector3df( 0.0f, 50.0f, 1000.0f ) );
	sun->setMaterialFlag( EMF_LIGHTING, false );
	sun->setMaterialTexture( 0, driver->getTexture("sun.png") );
	// Interesting stuff

	// As before, we make a renderer
	IPostProc* ppRenderer = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor( 255u, 100u, 101u, 140u ) );
	// Now make a flare effect:
	// (render from, output size, sun scene node)
	// can also use a vector instead of a scene node - when using a scene node the position will follow node automatically
	CLensFlarePostProc* ppFlare1 = new CLensFlarePostProc( ppRenderer, dimension2di( 1024, 512 ), driver->getTexture("flare.png"), sun, 50.0f );
	CLensFlarePostProc* ppFlare2 = new CLensFlarePostProc( ppFlare1, dimension2di( 1024, 512 ), driver->getTexture("flare.png"), vector3df( -2000.0f, 50.0f, 1000.0f ) );
	ppFlare2->setQuality( PPQ_CRUDE ); // Setting the quality to crude avoids pixel checking, which is slow (expecially when more than one lens flare), so if you use >1 flare, set most of them to crude.

	// These variables aren't important - they are just for showing the FPS
	wchar_t tmp[255]; u8 t = 0u;

	while( device->run( ) ) {
		cam->setPosition( vector3df( -(device->getCursorControl( )->getPosition( ).X - 320.0f) * 0.1f, (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.2f, -70.0f ) );
		driver->beginScene( false, driver->getDriverType( ) == video::EDT_DIRECT3D9 );
		ppFlare2->render( NULL );
		guienv->drawAll( );
		driver->endScene( );

		// Show the current FPS
		if( ++ t == 30u ) { t = 0u; swprintf(tmp, 255, L"%ls fps:%3d", driver->getName(), driver->getFPS() ); device->setWindowCaption( tmp ); }
	}

	delete ppFlare1;
	delete ppFlare2;
	delete ppRenderer;

	// Back to boring stuff
	device->drop();
	return 0;
}
开发者ID:tecan,项目名称:IrrlichtDemos,代码行数:56,代码来源:main.cpp

示例5: createDeviceEx

	extern "C" IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& params)
	{

		IrrlichtDevice* dev = 0;

#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
		if (params.DeviceType == EIDT_WIN32 || (!dev && params.DeviceType == EIDT_BEST))
			dev = new CIrrDeviceWin32(params);
#endif

#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
		if (params.DeviceType == EIDT_OSX || (!dev && params.DeviceType == EIDT_BEST))
			dev = new CIrrDeviceMacOSX(params);
#endif

#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
		if (params.DeviceType == EIDT_X11 || (!dev && params.DeviceType == EIDT_BEST))
			dev = new CIrrDeviceLinux(params);
#endif
        
#ifdef _IRR_COMPILE_WITH_IOS_DEVICE_
		if (params.DeviceType == EIDT_IOS || (!dev && params.DeviceType == EIDT_BEST))
			dev = new CIrrDeviceiOS(params);
#endif

#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
		if (params.DeviceType == EIDT_ANDROID || (!dev && params.DeviceType == EIDT_BEST))
			dev = new CIrrDeviceAndroid(params);
#endif

#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
		if (params.DeviceType == EIDT_SDL || (!dev && params.DeviceType == EIDT_BEST))
			dev = new CIrrDeviceSDL(params);
#endif

#ifdef _IRR_COMPILE_WITH_FB_DEVICE_
		if (params.DeviceType == EIDT_FRAMEBUFFER || (!dev && params.DeviceType == EIDT_BEST))
			dev = new CIrrDeviceFB(params);
#endif

#ifdef _IRR_COMPILE_WITH_CONSOLE_DEVICE_
		if (params.DeviceType == EIDT_CONSOLE || (!dev && params.DeviceType == EIDT_BEST))
			dev = new CIrrDeviceConsole(params);
#endif

		if (dev && !dev->getVideoDriver() && params.DriverType != video::EDT_NULL)
		{
			dev->closeDevice(); // destroy window
			dev->run(); // consume quit message
			dev->drop();
			dev = 0;
		}

		return dev;
	}
开发者ID:JosephAustin,项目名称:Irrlicht_iOS_View,代码行数:55,代码来源:Irrlicht.cpp

示例6: shadows

static bool shadows(video::E_DRIVER_TYPE driverType)
{
	IrrlichtDevice *device = createDevice (driverType, core::dimension2d<u32>(160,120), 16, false, true);
	if (!device)
		return true; // No error if device does not exist

	stabilizeScreenBackground(device->getVideoDriver());

	scene::ICameraSceneNode* cam = device->getSceneManager()->addCameraSceneNodeFPS();
	cam->setPosition(core::vector3df(-15,55,10));
	cam->setTarget(core::vector3df(-5,-5,-15));

	device->getSceneManager()->setAmbientLight(video::SColorf(.5f,.5f,.5f));
	scene::IMeshSceneNode* cube = device->getSceneManager()->addCubeSceneNode(100, 0, -1, core::vector3df(0,50,0));
	cube->setScale(core::vector3df(-1,-1,-1));

	scene::IAnimatedMeshSceneNode* node = device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->getMesh("../media/ninja.b3d"), 0, -1, core::vector3df(0,2,0), core::vector3df(),core::vector3df(5,5,5));
	node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
	node->addShadowVolumeSceneNode();
	node->setAnimationSpeed(0.f);

	scene::ILightSceneNode* light = device->getSceneManager()->addLightSceneNode(0, core::vector3df(10,10,10));
	light->setLightType(video::ELT_POINT);
	light->setRadius(500.f);
	light->getLightData().DiffuseColor.set(0,1,1);

	device->getVideoDriver()->beginScene (true, true, 0);
	device->getSceneManager()->drawAll();
	device->getVideoDriver()->endScene();

	bool result = takeScreenshotAndCompareAgainstReference(device->getVideoDriver(), "-stencilShadow.png", 99.91f);

	node->remove();
	cube->remove();
	// test self-shadowing
	node = device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->getMesh("../media/dwarf.x"));
	node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
	node->addShadowVolumeSceneNode();
	node->setAnimationSpeed(0.f);

	cam->setPosition(core::vector3df(0,55,-30));
	cam->setTarget(core::vector3df(60,45,150));

	device->getVideoDriver()->beginScene (true, true, 0);
	device->getSceneManager()->drawAll();
	device->getVideoDriver()->endScene();

	result = takeScreenshotAndCompareAgainstReference(device->getVideoDriver(), "-stencilSelfShadow.png", 99.41f);

	device->closeDevice();
	device->run();
	device->drop();

	return result;
}
开发者ID:AkshayGupta94,项目名称:stk-code,代码行数:55,代码来源:stencilshadow.cpp

示例7: main

int main()
{
	//Start up the engine (OpenGL)
	IrrlichtDevice *device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640,480));

	//Grab pointers to the driver and scenemanager
	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();

	device->setWindowCaption(L"Random Direction Affector Demo");

	//Setup the particle system scene node
	scene::IParticleSystemSceneNode* ps = smgr->addParticleSystemSceneNode();
	scene::IParticleEmitter* eaf = ps->createBoxEmitter(core::aabbox3df(-100,-1,-100,100,1,100),core::vector3df(0,-0.03,0),50,100,video::SColor(0,0,0,0),video::SColor(0,0,0,0),5000,5000);
	ps->setEmitter(eaf);
	eaf->drop();

	//Add the Random Direction Affector
	scene::IParticleAffector* aff = new scene::CRandomDirectionAffector(0.03,250);
	ps->addAffector(aff);
	aff->drop();

	//Disable Lighting
	ps->setMaterialFlag(video::EMF_LIGHTING,false);

	// add a static camera
	smgr->addCameraSceneNode(0,core::vector3df(0,0,-300),core::vector3df(0,0,0));

	int lastFPS = -1;

	// draw everything (should be self explanitory, otherwise check out the hello world tutorial)
	while(device->run())
	{
		driver->beginScene(true, true, video::SColor(255,64,64,64));
		smgr->drawAll();
		driver->endScene();

		int fps = driver->getFPS();

		if (lastFPS != fps)
		{
			core::stringw str = L"Scale Affector Demo [";
			str += driver->getName();
			str += "] FPS:";
			str += fps;

			device->setWindowCaption(str.c_str());
			lastFPS = fps;
		}
	}

	// delete device
	device->drop();
	return 0;
}
开发者ID:DarkKilauea,项目名称:IrrlichtParticleAffectors,代码行数:55,代码来源:main.cpp

示例8: init

// ----------------------------------------------------------------------------
bool Editor::init()
{
    m_maps_path         = NULL;
    m_music_loc         = NULL;
    m_indicator         = NULL;
    m_valid_data_dir    = false;
    m_exe_loc           = "";
    m_toolbar           = NULL;
    m_toolbox           = NULL;
    m_rcs               = NULL;
    m_tex_sel           = NULL;
    m_indicator         = NULL;
    m_viewport          = NULL;
    m_rcs               = NULL;
    m_font              = NULL;
    m_new_dialog_wndw   = NULL;

    m_screen_size = dimension2du(10, 10);

    IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
    m_screen_size = nulldevice->getVideoModeList()->getDesktopResolution();
    readConfigFile(nulldevice->getFileSystem());
    nulldevice->drop();

    m_device = createDevice(EDT_OPENGL, m_screen_size, 16, false, false, true);
    if (!m_device) return false;

    m_device->setResizable(true);
    m_device->setWindowCaption(L"SuperTuxKart Track Editor Beta v0.03");

    if (m_screen_size.Width < 20 || m_screen_size.Height < 20)
        m_device->maximizeWindow();

    m_video_driver  = m_device->getVideoDriver();
    m_scene_manager = m_device->getSceneManager();
    m_gui_env       = m_device->getGUIEnvironment();

    m_screen_size   = m_video_driver->getScreenSize();
    m_def_wd        = m_device->getFileSystem()->getWorkingDirectory();

    // lights
    m_scene_manager->setAmbientLight(SColorf(0.3f, 0.3f, 0.3f, 1.0f));
    ILightSceneNode* l = m_scene_manager->addLightSceneNode(0, vector3df(0, 1, 0),
                                              SColorf(1.0f, 1.0f, 1.0f), 500, -1);
    l->setLightType(ELT_DIRECTIONAL);
    l->setPosition(vector3df(0,
        1, 0));

    m_device->setEventReceiver(this);

    if (!isValidDataLoc()) dataDirLocDlg();

    return true;
} // init
开发者ID:CruzR,项目名称:stk-editor,代码行数:55,代码来源:editor.cpp

示例9: b3dAnimation

/** Verify that two skinned animated mesh scene nodes can use different frames of the skinned mesh */
bool b3dAnimation(void)
{
	// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
	IrrlichtDevice *device = createDevice( EDT_BURNINGSVIDEO, dimension2d<s32>(160, 120), 32);
	assert(device);
	if (!device)
		return false;

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager * smgr = device->getSceneManager();

	IAnimatedMesh* mesh = smgr->getMesh("../media/ninja.b3d");
	IAnimatedMeshSceneNode* node1;
	IAnimatedMeshSceneNode* node2;
	assert(mesh);

	bool result = false;
	if(mesh)
	{
		node1 = smgr->addAnimatedMeshSceneNode(mesh);
		assert(node1);

		if(node1)
		{
			node1->setPosition(vector3df(-3, -3, 10));
			node1->setMaterialFlag(EMF_LIGHTING, false);
			node1->setAnimationSpeed(0.f);
		}

		node2 = smgr->addAnimatedMeshSceneNode(mesh);
		assert(node2);
		if(node2)
		{
			node2->setPosition(vector3df(3, -3, 10));
			node2->setMaterialFlag(EMF_LIGHTING, false);
			node2->setAnimationSpeed(0.f);
			node2->setCurrentFrame(62.f);
		}

		(void)smgr->addCameraSceneNode();

		// Just jump to the last frame since that's all we're interested in.
		device->run();
		driver->beginScene(true, true, SColor(255, 255, 255, 0));
		smgr->drawAll();
		driver->endScene();

		result = takeScreenshotAndCompareAgainstReference(driver, "-b3dAnimation.png");
	}

	device->drop();

	return result;
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:55,代码来源:b3dAnimation.cpp

示例10: print_video_modes

bool ClientLauncher::print_video_modes()
{
    IrrlichtDevice *nulldevice;

    bool vsync = g_settings->getBool("vsync");
    u16 fsaa = g_settings->getU16("fsaa");
    MyEventReceiver* receiver = new MyEventReceiver();

    SIrrlichtCreationParameters params = SIrrlichtCreationParameters();
    params.DriverType    = video::EDT_NULL;
    params.WindowSize    = core::dimension2d<u32>(640, 480);
    params.Bits          = 24;
    params.AntiAlias     = fsaa;
    params.Fullscreen    = false;
    params.Stencilbuffer = false;
    params.Vsync         = vsync;
    params.EventReceiver = receiver;
    params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu");

    nulldevice = createDeviceEx(params);

    if (nulldevice == NULL) {
        delete receiver;
        return false;
    }

    dstream << _("Available video modes (WxHxD):") << std::endl;

    video::IVideoModeList *videomode_list = nulldevice->getVideoModeList();

    if (videomode_list != NULL) {
        s32 videomode_count = videomode_list->getVideoModeCount();
        core::dimension2d<u32> videomode_res;
        s32 videomode_depth;
        for (s32 i = 0; i < videomode_count; ++i) {
            videomode_res = videomode_list->getVideoModeResolution(i);
            videomode_depth = videomode_list->getVideoModeDepth(i);
            dstream << videomode_res.Width << "x" << videomode_res.Height
                    << "x" << videomode_depth << std::endl;
        }

        dstream << _("Active video mode (WxHxD):") << std::endl;
        videomode_res = videomode_list->getDesktopResolution();
        videomode_depth = videomode_list->getDesktopDepth();
        dstream << videomode_res.Width << "x" << videomode_res.Height
                << "x" << videomode_depth << std::endl;

    }

    nulldevice->drop();
    delete receiver;

    return videomode_list != NULL;
}
开发者ID:4aiman,项目名称:MultiCraft,代码行数:54,代码来源:clientlauncher.cpp

示例11: pixelAccuracy

// this test draws alternating white and black borders with
// increasing thickness. Intended use of this test is to ensure
// the corect pixel alignment within the render window.
static bool pixelAccuracy(E_DRIVER_TYPE driverType)
{
	IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
	if (!device)
		return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs

	IVideoDriver* driver = device->getVideoDriver();

	stabilizeScreenBackground(driver);

	logTestString("Testing driver %ls\n", driver->getName());

	device->getSceneManager()->addCameraSceneNode();

	driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140));
	u32 start=0;
	for (u32 count=1; count<10; ++count)
	{
		for (u32 j=0; j<count; ++j)
		{
			for (u32 x=0; x<100-start; ++x)
			{
				driver->drawPixel(start+x, start, (count%2==1)?0xffffffff:0xff000000);
			}
			++start;
		}
	}
	start=0;
	for (u32 count=1; count<10; ++count)
	{
		for (u32 j=0; j<count; ++j)
		{
			for (u32 x=0; x<100-start; ++x)
			{
				driver->drawPixel(start, start+x, (count%2==1)?0xffffffff:0xff000000);
			}
			++start;
		}
	}
	for (u32 x=0; x<100; ++x)
	{
		driver->drawPixel(x, x, 0xffff0000);
	}
	driver->endScene();

	bool result = takeScreenshotAndCompareAgainstReference(driver, "-pixelAccuracy.png");

	device->closeDevice();
	device->run();
	device->drop();

	return result;
}
开发者ID:vgck,项目名称:irrnacht,代码行数:56,代码来源:drawPixel.cpp

示例12: testXML

/** Tests for XML handling */
bool testXML(void)
{
	IrrlichtDevice *device = createDevice(video::EDT_NULL, dimension2du(400, 200));

	bool result = true;

	result &= simple_xml(device->getFileSystem());
	result &= cdata(device->getFileSystem());
	result &= attributeValues(device->getFileSystem());	

	device->drop();
	return result;
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:14,代码来源:testXML.cpp

示例13: init_irrlicht

void init_irrlicht(bool32 fullscreen)
{
    irrlicht->device = 0;
    irrlicht->driver = 0;
    irrlicht->smgr = 0; 
    irrlicht->hud = 0; 
    irrlicht->stencil_buffer = false;

    if (fullscreen)
    {
        // create a NULL device to detect screen resolution
        IrrlichtDevice *nulldevice = createDevice(EDT_NULL);
        dimension2d<u32> deskres = nulldevice->getVideoModeList()->getDesktopResolution();
        nulldevice->drop();
        irrlicht->device = createDevice( EDT_OPENGL, deskres, 32, true, irrlicht->stencil_buffer, true );
    }
    else
    {
        //device = createDevice( EDT_OPENGL, dimension2d<u32>(1280, 720), 32, false, stencil_buffer, false);
        irrlicht->device = createDevice( EDT_OPENGL, dimension2d<u32>(SCREEN_WIDTH, SCREEN_HEIGHT), 32, false, irrlicht->stencil_buffer, false);
    }

    if (!irrlicht->device)
    {
        std::cout << "ERROR: Failed to create Irrlicht device." << std::endl; 
        return;
    }
    irrlicht->device->setWindowCaption(L"Secret");

    irrlicht->driver = irrlicht->device->getVideoDriver();
    if (!irrlicht->driver)
    {
        std::cout << "ERROR: Failed to create Irrlicht driver." << std::endl;
        return;
    }

    irrlicht->smgr = irrlicht->device->getSceneManager();
    if (!irrlicht->smgr)
    {
        std::cout << "ERROR: Failed to create Irrlicht smgr." << std::endl;
        return;
    }
    irrlicht->hud = irrlicht->smgr->createNewSceneManager();
    if (!irrlicht->hud)
    {
        std::cout << "ERROR: Failed to create Irrlicht hud." << std::endl;
        return;
    }

    irrlicht->colmgr = irrlicht->smgr->getSceneCollisionManager(); 
} 
开发者ID:blaketrahan,项目名称:coquelicot,代码行数:51,代码来源:cirrlicht.cpp

示例14: loadScene

static bool loadScene(void)
{
	IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO,
										core::dimension2du(160,120), 32);
	if (!device)
		return false;

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	// load scene from example, with correct relative path
	device->getFileSystem()->changeWorkingDirectoryTo("results");
	smgr->loadScene("../../media/example.irr");
	smgr->addCameraSceneNode(0, core::vector3df(0,0,-50));
	device->getFileSystem()->changeWorkingDirectoryTo("..");

	bool result = false;
	device->run();
	device->getTimer()->setTime(666);	// scene has animations and current scene seems to be saved at that time ... really - best result with just that number :-)
	if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80)))
	{
		smgr->drawAll();
		driver->endScene();
		// we need to be very sloppy, because the animators will produce a different
		// start depending on the actual loading time. 97% seems to be safe, as removing
		// an object produces values around 95%
		result = takeScreenshotAndCompareAgainstReference(driver, "-loadScene.png", 97.4f);
		if (!result)
			logTestString("Rendering the loaded scene failed.\n");
	}

	ISceneNode* node = smgr->getSceneNodeFromId(128);
	if (!node)
		result=false;
	else if (result) // only check if scene was correctly loaded
	{
		result &= (node->getChildren().size()==0);
		if (!result)
			logTestString("Node has an illegal child node.\n");
		device->getSceneManager()->loadScene("results/scene2.irr", 0, node);
		result &= (node->getChildren().size()!=0);
		if (!result)
			logTestString("Loading second scene as child failed.\n");
	}

	device->closeDevice();
	device->run();
	device->drop();

	return result;
}
开发者ID:AkshayGupta94,项目名称:stk-code,代码行数:50,代码来源:ioScene.cpp

示例15: main

int main(void)
{
    IrrlichtDevice *device = createDevice(video::EDT_OPENGL);
    video::IVideoDriver *driver = device->getVideoDriver();

    while(device->run())
    {
	driver->beginScene(true, true, video::SColor(0,255,255,255));
	driver->endScene();
    }

    device->drop();
    return 0;
}
开发者ID:NiReaS68,项目名称:DevGame-Tuto,代码行数:14,代码来源:main.cpp


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