我的Irrlicht学习笔记1——环境配置

来源:互联网 发布:json框架有哪些 编辑:程序博客网 时间:2024/05/22 03:19

我用的是vs2015,下载的版本是Irrlicht1.84
第一步:用vs新建一个工程(我建的是空工程)然后在Project->Properties->Configuration Properties->VC++ Directories的目录下,分别找到Include Directories和

Library Directories。


第二步:给Include Directories添加路径:Irrlicht1.84\include\

第三步:给Library Directories添加路径:Irrlicht1.84\lib\win64-visualStudio(如果你是32位

的就写32的那个)

第四步:在引擎安装目录\bin\Win64-visualStudio(照理说应该用对应的版本,但是如果成功不了,可以换一个试试看)中,找

到Irrlicht.dll文件,把它复制到你的工程文件目录下(\解决方案名称\项目名称,就是这个目录),否则运行的时候会报错的。

之后你就可以照着网上找一个helloworld程序试验一下了(下面附一个我抄来的代码)

#include <irrlicht.h>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")#endifint main(){    IrrlichtDevice *device =        createDevice( video::EDT_SOFTWARE, dimension2d<u32>(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<s32>(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;}


0 0