miércoles, 8 de abril de 2015

Figuras en Irrlicht


#include <irrlicht.h>

//los namespace para definir funciones de irrlicht
using namespace irr;
using namespace core;
using namespace video;

#if defined(_MSC_VER)
#pragma comment(lib, "Irrlicht.lib")
#endif

int main()
{
 //define un device para la pantalla
 IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(640, 480), 16, false,
  false, false, 0);

 //en caso de error
 if (!device)
  return 1;

 //Creo un driver de video
 IVideoDriver *driver = device->getVideoDriver();

 //Gameloop
 while (device->run())
 {
  driver->beginScene(true, true, SColor(255,200,200,200));
 
  //Dibujo figuras geometricas
  //Rectangulo
  driver->draw2DRectangle(SColor(255, 255, 128, 64), rect<s32>(40, 40, 200, 200));

  //Poligono
  driver->draw2DPolygon(position2d<s32>(100, 300), 50.f, SColor(128, 40, 80, 16), 6);

  //linea
  driver->draw2DLine(position2d<s32>(20 , 20), position2d<s32>(620, 460 ) , SColor(255, 0, 255, 255));

  driver->endScene();
 }

 //cerrar device
 device->drop();

 return 0;
}


No hay comentarios:

Publicar un comentario