Is there a way to use only part of an image in Irrlicht?
Example: I have an image which contains a bunch of game menu buttons. I would like to load and display those buttons individually, yet they are from the same image. I need a way to "split" that image, or, if you will, only load part of it.
I believe I have found a method, but it's incredibly ugly and I'd like to avoid it at all costs, especially if Irrlicht already supports this and I simply didn't see it.
Yes, I know about Magic2D, but I'd rather not limit myself to the OpenGL driver.
Using only part of an image
Look at the 2D Tutorial. It goes over how to do this.
It is the draw2DImage function:
Documentation:
I am using this for an orthogonal tile game.
JRM
It is the draw2DImage function:
Documentation:
Code: Select all
virtual void irr::video::IVideoDriver::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
) [pure virtual]
Draws a part of the texture into the rectangle.
Suggested and first implemented by zola.
Parameters:
texture,: the texture to draw from
destRect,: the rectangle to draw into
sourceRect,: the rectangle denoting a part of the texture
clipRect,: cipps the destination rectangle (may be 0)
colors,: array of 4 colors denoting the color values of the corners of the destRect
useAlphaChannelOfTexture,: true if alpha channel will be blended.
JRM
Good grief, how dumb am I? Thank you so much... 
Last edited by AndyCR on Fri Mar 10, 2006 12:00 am, edited 1 time in total.
