domingo, 24 de agosto de 2008

Template 2º (LISTO PARA COPIAR Y COMPILAR)

#include
#include
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() {

// Inicializamos Irrlicht
IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d (640, 480), 32, false, false, false, 0);

// Guardamos los apuntadores que serán de utilidad
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();

// Le ponemos un título a nuestra ventana
device->setWindowCaption(L"Hola Mundo en Irrlicht [--A M T--]");

// Creamos un cubo
scene::ISceneNode* cubo = smgr->addCubeSceneNode();
cubo->setPosition(vector3df(0,0,0));
cubo->setScale(vector3df(2,2,2));
cubo->setRotation(vector3df(0,0,5));



cubo->setMaterialTexture( 0, driver->getTexture("../../media/293.jpg") );
cubo->setMaterialFlag(EMF_LIGHTING, false);


//cubo->setMaterialTexture(1, driver->getTexture("../../media/terrain-1.jpg"));
//cubo->setMaterialFlag(video::EMF_LIGHTING, false);
//Creamos una camara
smgr->addCameraSceneNode(0, vector3df(0, 30, -40), vector3df(0, 0, 0));



// El ciclo principal de nuestra aplicación

while (device->run())

{

cubo->setRotation(cubo->getRotation() + vector3df(0.01,0.01,0.01));



driver->beginScene(true, true, SColor(255, 255, 255, 140));
smgr->drawAll();
driver->endScene();




}

// Nos aseguramos de cerrar de manera adecuada Irrlicht
device->drop();

// Siempre es bueno regresar un cero para indicar que todo salió bien
return 0;
}

No hay comentarios: