irrlicht引擎示例代码研究(1)
2009-08-30 21:37
302 查看
//刚刚接触irrlicht引擎,感觉挺简单,上手快,在这里晒一晒简单的代码及注释
//不懂的函数和类信息看官方文档,那里什么都有
#include <irrlicht/irrlicht.h> //本人将irr中的文件都放在irrlicht文件夹中,和系统include放在一起
#pragma comment(lib,"irrlicht.lib")
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main()
{
IrrlichtDevice *device = //创建一个irr设备,可理解为创建一个窗体createwindow,个人感觉更像是OpenGL
//在windows环境下的初始化工作,GDI设备
#ifdef _IRR_OSX_PLATFORM_
createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
#else
createDevice( video::EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
#endif
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo"); //设置窗口名字
IVideoDriver* driver = device->getVideoDriver(); //创建一个录像驱动,不知道是干什么的
//由后面的run循环可知,这个东西还真是个驱动,
//是前提
ISceneManager* smgr = device->getSceneManager(); //创建一个场景管理器,用于设置镜头等
IGUIEnvironment* guienv = device->getGUIEnvironment(); //创建一个gui环境,可以理解为一个添加控件的接口
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(100,100,300,130), true); //gui环境中添加一个静态文本“控件”
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0)); //场景管理器——设置摄像头
while(device->run()) //主循环呗,整个程序的交互部分就在这了
{
driver->beginScene(true, true, SColor(255,100,101,140)); //Applications must call this method
//before performing any rendering.
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop(); //于前面的createDevice()对应
return 0;
}
//不懂的函数和类信息看官方文档,那里什么都有
#include <irrlicht/irrlicht.h> //本人将irr中的文件都放在irrlicht文件夹中,和系统include放在一起
#pragma comment(lib,"irrlicht.lib")
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main()
{
IrrlichtDevice *device = //创建一个irr设备,可理解为创建一个窗体createwindow,个人感觉更像是OpenGL
//在windows环境下的初始化工作,GDI设备
#ifdef _IRR_OSX_PLATFORM_
createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
#else
createDevice( video::EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
false, false, false, 0);
#endif
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo"); //设置窗口名字
IVideoDriver* driver = device->getVideoDriver(); //创建一个录像驱动,不知道是干什么的
//由后面的run循环可知,这个东西还真是个驱动,
//是前提
ISceneManager* smgr = device->getSceneManager(); //创建一个场景管理器,用于设置镜头等
IGUIEnvironment* guienv = device->getGUIEnvironment(); //创建一个gui环境,可以理解为一个添加控件的接口
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(100,100,300,130), true); //gui环境中添加一个静态文本“控件”
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0)); //场景管理器——设置摄像头
while(device->run()) //主循环呗,整个程序的交互部分就在这了
{
driver->beginScene(true, true, SColor(255,100,101,140)); //Applications must call this method
//before performing any rendering.
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop(); //于前面的createDevice()对应
return 0;
}
相关文章推荐
- irrlicht引擎示例代码研究(2)
- iOS6新特征:UICollectionView官方使用示例代码研究
- 【Android LibGDX游戏引擎开发教程】第03期:示例代码详细讲解
- Singleton模式的C++实现研究(示例代码)
- Singleton模式的C++实现研究(示例代码)
- iOS6新特征:UICollectionView官方使用示例代码研究
- esper 事件引擎,各种事件类型示例代码
- ASP.NET的地址重写“.NET研究”(URLRewriter)实现原理及代码示例
- 开源的游戏引擎irrlicht中不使用比较、条件、三元运算求最值与中值的代码
- js动画(animate)简单引擎代码示例
- Irrlicht 0.1引擎源码分析与研究(三)
- Singleton模式的C++实现研究(示例代码)
- CCS+C6678LE开发记录08:以太网接口测试示例之代码研究
- UICollectionView官方使用示例代码研究
- Irrlicht 0.1引擎源码分析与研究(二)
- Irrlicht游戏引擎初步分析与研究
- 开源的游戏引擎irrlicht中不使用比较、条件、三元运算求最值与中值的代码
- js动画(animate)简单引擎代码示例
- 有研究irrlicht引擎的吗,交流交流
- (虚幻3游戏引擎)Unreal3的Flash移植演讲代码示例!