IImage etc.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Donner
Posts: 87
Joined: Fri May 18, 2007 11:27 am

IImage etc.

Post by Donner »

Hi,

I searched for more than three hours now, and I found many answers to the following question, but I have problems tu understand them.

Well, if I want to resize a Image, which should be drawed to the Screen, I should use the copyToScaling-Function of IImage, right?

So far so good, but I didn't find any example, how to load an IImage and to draw it to the screen.

Could someone explain me?

What is the best way to load an image, scale it and draw it to the screen?
It would be very nice if someone could post a littlie bit code. I will not use the copy and paste method, but I think an example is the best way to explain something.

Thanks

D.
CaptainPants
Posts: 19
Joined: Wed Dec 06, 2006 10:15 am

Post by CaptainPants »

I can't find any ways to directly draw an IImage to the screen.

It seems that you have to use
IVideoDriver::createTexture
to make a texture from it and then use
IVideoDriver::draw2DImage
to draw it to the screen

-----

I'm not too experianced, but my suggestion would be to use
IVideoDriver::addTexture
to load the image, and use
IVideoDriver::draw2DImage
to resize and draw it to the screen in one go.

Note: there are a bunch of versions of draw2DImage,

draw2DImage(video::ITexture *texture, const core::rect< s32 > &destRect, const core::rect< s32 > &sourceRect, const core::rect< s32 > *clipRect=0, video::SColor *colors=0, bool useAlphaChannelOfTexture=false);

Seems to do what you need..

good luck,
~~Captain Pants
Post Reply