vs2015与Irrlicht鬼火引擎

一、Irrlicht源代码相关

下载地址:http://irrlicht.sourceforge.net/downloads/

解压后的目录结构:

vs2015与Irrlicht鬼火引擎_第1张图片

使用该引擎创建应用程序主要与bin、include和lib文件夹相关。


二、创建空项目和设置

2.1 创建C++空项目

2.2 包含目录和链接目录设定

菜单中的 项目->属性->VC++目录,为引用目录添加引擎源代码的include目录,为库目录添加引擎源代码下的lib/Win64-visualStudio,这里应该对应你相应的平台。

2.3拷贝dll文件

将bin\Win64-VisualStudio\Irrlicht.dll拷贝到项目根目录中。


三、测试

代码:

#include 

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif

int main()
{
	IrrlichtDevice *device =
		createDevice(video::EDT_SOFTWARE, dimension2d(640, 480), 16,
			false, false, false, 0);

	if (!device)
		return 1;

	device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");

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

	guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
		rect(10, 10, 260, 22), true);

	smgr->addCameraSceneNode(0, vector3df(0, 30, -40), vector3df(0, 5, 0));

	while (device->run())
	{

		driver->beginScene(true, true, SColor(255, 100, 101, 140));

		smgr->drawAll();
		guienv->drawAll();

		driver->endScene();
	}


	device->drop();

	return 0;
}

代码来源:http://www.cnblogs.com/tail/p/3190808.html

成功运行会出现HelloWorld的窗口。


四、可能的错误

4.1 提示:应用程序无法正常启动0xc000007b

原因:平台环境和库文件不匹配

4.2 编译器警告找不到头文件

原因:平台环境和库文件不匹配

4.3 C:\Windows\SysWOW64\ntdll.dll”。无法查找或打开 PDB 文件。

解决方案:http://zhidao.baidu.com/link?url=4DYnaCDC9Ily-wBbvGulfs-kCV1uryJvg2h7dheblAZ113YSQceGyoNF6bfkaY3hMI3juJUqYGNcU4EiJZNyBCcAHocgi1vSQMaIUrTY0pK


相关阅读:http://www.cnblogs.com/tail/p/3190808.html

你可能感兴趣的:(Irrlicht鬼火引擎)