I wanted to display an image using GUIEnvironment, so basically what I did was,
- Created a texture
- called gui_env->addImage() function.
This works perfectly.
But my question is, this method always draws the whole image/texture, is there any way I can draw only selected rectangular region from the source image (SDL anyone?).
Here is the code I used,
Code: Select all
//
//
// g++ -I/home/laeeq/irrl/irrlicht-1.7.1/include -L/home/laeeq/irrl/irrlicht-1.7.1/lib/Linux gui_2.cc -lIrrlicht -lGL -lXxf86vm -lXext -lX11
//
//
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main()
{
IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(800, 600));
if (device == 0)
{
printf("%s:%u Unable to create device\n", __FILE__, __LINE__);
return 1;
}
else
printf("%s:%u Device created\n", __FILE__, __LINE__);
IVideoDriver* driver = device->getVideoDriver();
IGUIEnvironment* env = device->getGUIEnvironment();
// ITexture* images = driver->getTexture("/home/laeeq/irrl/irrlicht-1.7.1/media/fireball.bmp");
// ITexture* images = driver->getTexture("/home/laeeq/multi_media/frames/pwr_2.bmp");
ITexture* images = driver->getTexture("/home/laeeq/multi_media/frames/non_pwr_2.bmp");
env->addImage(images, position2d<int>(10,10));
while(device->run() && driver)
{
if (device->isWindowActive())
{
driver->beginScene(true, true, video::SColor(255,120,102,136));
env->drawAll();
driver->endScene();
}
}
device->drop();
return 0;
}