Example:
Code: Select all
#include <IrrBox2d.h>
using namespace irr;
using namespace core;
using namespace video;
using namespace scene;
using namespace gui;
using namespace io;
#pragma comment(lib, "IrrBox2d.lib")
#pragma comment(lib, "Irrlicht.lib")
int main()
{
IrrlichtDevice* dvc = createDevice(EDT_OPENGL, dimension2d<s32>(800, 600));
IVideoDriver* drv = dvc->getVideoDriver();
IWorld* w = createWorld(dvc, 1.0f, dimension2d<s32>(800, 600));
IEntityManager* em = w->getEntityManager();
em->createStaticEntity(position2d<s32>(5, 500), drv->getTexture("platform.png"));
em->createDynamicEntity(position2d<s32>(5, 5), 1.0f, 0.3f, drv->getTexture("red.png"));
em->createDynamicEntity(position2d<s32>(5, 305), 1.0f, 0.3f, drv->getTexture("green.png"));
while(dvc->run())
{
drv->beginScene(true, true, SColor(0, 0, 0, 0));
w->update(1.0f / 60.0f, 10);
drv->endScene();
}
w->remove();
delete w;
return 0;
}
Download link