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


C++ IVideoDriver::getImageLoader方法代码示例

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


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

示例1: enumerateImageManipulators

bool enumerateImageManipulators(void)
{
    IrrlichtDevice *device = createDevice(video::EDT_NULL);
    if (!device)
        return false;

    IVideoDriver* driver = device->getVideoDriver();

	const char* filenames[] = 
	{
		"foo.bmp",
		"foo.jpg",
		"foo.pcx",
		"foo.png",
		"foo.ppm",
		"foo.psd",
		"foo.tga",
		// the following have no writers
		"foo.wal",
		"foo.pgm",
		"foo.pbm",
		"foo.rgb",
		"foo.rgba",
		"foo.sgi",
		"foo.int",
		"foo.inta",
		"foo.bw"
	};
	// how many formats have loaders?
	const u32 writersUntil = 7;

	const u32 numberOfFilenames = sizeof(filenames) / sizeof(filenames[0]);
	bool loaderForFilename[numberOfFilenames] = { false }; // and the rest get 0 == false
	bool writerForFilename[numberOfFilenames] = { false }; // and the rest get 0 == false

	bool result = true;

	u32 i;
	const u32 loaders = driver->getImageLoaderCount();
	for (i = 0; i < loaders; ++i)
	{
		IImageLoader * loader = driver->getImageLoader(i);
		
		if(!loader)
		{
			logTestString("Failed to get image loader %d\n", i);
			assert(false);
			result = false;
		}

		for(u32 filename = 0; filename < numberOfFilenames; ++filename)
		{
			if(loader->isALoadableFileExtension(filenames[filename]))
			{
				loaderForFilename[filename] = true;
			}
		}
	}

	IImageLoader * loader = driver->getImageLoader(i);
	assert(loader == 0);
	if(loader)
	{
		logTestString("Got a loader when none was expected (%d)\n", i);
		result = false;
	}

	for(u32 filename = 0; filename < numberOfFilenames; ++filename)
	{
		if(!loaderForFilename[filename])
		{
			logTestString("File type '%s' doesn't have a loader\n", filenames[filename]);
			assert(false);
			result = false;
		}
	}

	const u32 writers = driver->getImageWriterCount();
	for (i = 0; i < writers; ++i)
	{
		IImageWriter * writer = driver->getImageWriter(i);
		
		if(!writer)
		{
			logTestString("Failed to get image writer %d\n", i);
			assert(false);
			result = false;
		}

		for(u32 filename = 0; filename < numberOfFilenames; ++filename)
		{
			if(writer->isAWriteableFileExtension(filenames[filename]))
			{
				writerForFilename[filename] = true;
				break;
			}
		}
	}

	IImageWriter * writer = driver->getImageWriter(i);
//.........这里部分代码省略.........
开发者ID:EEmmanuel7,项目名称:irrlicht-android-1,代码行数:101,代码来源:enumerateImageManipulators.cpp


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