Main.cpp
Code: Select all
#include "header.cpp"
int main()
{
CreateWindow();
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(10,10,260,22), true);
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
if (!mesh)
return 1;
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_STAND);
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
}
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;
}
Code: Select all
#ifndef _HEADER_H_
#define _HEADER_H_
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int CreateWindow();
#endif _HEADER_H_
Code: Select all
#include <irrlicht.h>
#include "header.h"
#pragma once
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int CreateWindow()
{
IrrlichtDevice *device =
#ifdef _IRR_OSX_PLATFORM_
createDevice( video::EDT_OPENGL, dimension2d<s32>(1024, 768), 16,
false, false, false, 0);
#else
createDevice( video::EDT_SOFTWARE, dimension2d<s32>(1024, 768), 16,
false, false, false, 0);
#endif
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
}
Code: Select all
1>main.cpp
1>d:\swift\main.cpp(10) : error C2065: 'guienv' : undeclared identifier
1>d:\swift\main.cpp(10) : error C2227: left of '->addStaticText' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\swift\main.cpp(14) : error C2065: 'smgr' : undeclared identifier
1>d:\swift\main.cpp(14) : error C2227: left of '->getMesh' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\swift\main.cpp(17) : error C2065: 'smgr' : undeclared identifier
1>d:\swift\main.cpp(17) : error C2227: left of '->addAnimatedMeshSceneNode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\swift\main.cpp(24) : error C2065: 'driver' : undeclared identifier
1>d:\swift\main.cpp(24) : error C2227: left of '->getTexture' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\swift\main.cpp(28) : error C2065: 'smgr' : undeclared identifier
1>d:\swift\main.cpp(28) : error C2227: left of '->addCameraSceneNode' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\swift\main.cpp(31) : error C2065: 'device' : undeclared identifier
1>d:\swift\main.cpp(31) : error C2227: left of '->run' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\swift\main.cpp(31) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Build log was saved at "file://d:\Swift\Debug\BuildLog.htm"
1>Swift - 13 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========