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

本文详细介绍了如何在Visual Studio 2015中集成Irrlicht 1.84游戏引擎。步骤包括配置项目的包含目录及库目录、复制必要的DLL文件到工程目录,并提供了一个简单的Hello World示例程序。

我用的是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")
#endif

int 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;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值