Code: Select all
#include <irrlicht.h>
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
using namespace irr;
using namespace scene;
using namespace video;
using namespace gui;
using namespace core;
/*** main function **************************************************************/
int main(int argc, char* argv[])
{
u32 height = 300;
u32 width = 400;
IrrlichtDevice* device = createDevice(video::EDT_OPENGL, dimension2d<s32>(width, height), 32,
false, false, true);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
smgr->addCameraSceneNode();
ISceneNode* renderNode = smgr->addCubeSceneNode(40, 0, -1, vector3df(12,-12,68), vector3df(0, 0, 0));
ITexture* renderTexture = driver->createRenderTargetTexture(dimension2d<s32>(256, 256));
renderNode->getMaterial(0).setTexture(0, renderTexture);
IGUIStaticText* text = 0;
IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->getSkin()->setColor(EGDC_BUTTON_TEXT, SColor(255,255,255,255));
text = guienv->addStaticText(L"Here we go!",
rect<s32>(32, height - 32 - 16, width - 32, height - 16), false, false);
u8 debugTimer=0;
while(device->run())
{
if (++debugTimer > 15)
{
debugTimer = 0;
stringw str = "UPSIDE DOWN TEXT?: ";
str += rand() % 52308823;
str += " TIME: ";
str += device->getTimer()->getRealTime();
str += " ____UNDERLINES_____";
text->setText(str.c_str());
}
driver->beginScene(true, true, 0);
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
}
Code: Select all
//ITexture* renderTexture = driver->createRenderTargetTexture(dimension2d<s32>(256, 256));
//renderNode->getMaterial(0).setTexture(0, renderTexture);