I need use more code in my "main loop" to work ?
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <irrlicht.h>
#include "cinifile.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#pragma comment(lib, "Irrlicht.lib")
int main()
{
IrrlichtDevice *device = createDevice(EDT_SOFTWARE, dimension2d<s32>(800, 600), 16, false, false, false, 0);
device->setWindowCaption(L"Resgate do Rebanho");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
int lastFPS = -1;
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",rect<int>(10,10,200,22), true);
IAnimatedMesh* mesh = smgr->getMesh("C:/irrlicht-1.3/media/sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop(0, 310);
node->setMaterialTexture( 0, driver->getTexture("C:/irrlicht-1.3/media/sydney.bmp") );
}
char fileup[50]="D:/apl/games/HP/textures/skies/l1_UP.bmp";
char filedn[50]="D:/apl/games/HP/textures/skies/l1_DN.bmp";
char filelf[50]="D:/apl/games/HP/textures/skies/l1_LT.bmp";
char filert[50]="D:/apl/games/HP/textures/skies/l1_RT.bmp";
char fileft[50]="D:/apl/games/HP/textures/skies/l1_FR.bmp";
char filebk[50]="D:/apl/games/HP/textures/skies/l1_BK.bmp";
ICameraSceneNode *camera = smgr->addCameraSceneNode( 0,vector3df(0,30,-40), vector3df(0,5,0));
ISceneNode *sky = smgr->addSkyBoxSceneNode(
driver->getTexture(fileup),
driver->getTexture(filedn),
driver->getTexture(filelf),
driver->getTexture(filert),
driver->getTexture(fileft),
driver->getTexture(filebk));
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
camera->setFarValue(50000);
while(device->run())
{
driver->beginScene(true, true, SColor(255,113,113,133) );
smgr->drawAll();
guienv->drawAll();
driver->endScene();
sky->setVisible(true);
int FPS = driver->getFPS();
if (lastFPS != FPS)
{
wchar_t tmp[1024];
swprintf(tmp,1024,L"[WIP] Rebanho Resgate - [%ls] fps: %d",driver->getName(), FPS);
device->setWindowCaption(tmp);
lastFPS = FPS;
}
}
device->drop();
return 0;
}