As an example, the fireball texture is 64*64 pixels and I want to pass in the whole image rectangle.
Should I use a rectangle as follows? (0 to 63)
- Code: Select all
ITexture * fireballTexture = driver->getTexture("../media/fireball.bmp");
recti fireballTextureFrame(0,0, 63, 63);
driver->draw2DImage(fireballTexture, vector2di(0,0), fireballTextureFrame);
When you get the width of a rectangle, it returns the length from the upper left starting point to the lower right point. It's not the count of pixels if you were thinking in discrete values.
The rectangle above for example, would return a width of 63 and height of 63.
So, what do you get when you ask for the size of a texture?
- Code: Select all
ITexture * fireballTexture = driver->getTexture("../media/fireball.bmp");
irr::core::dimension2di textureSize(fireballTexture->getSize());
Does it give you the width and height of the rectangle?
Or does it return the number of pixels across and down? Which would be width+1 and height+1 (if you were thinking like a rectangle).
This problem has messed up my calculations slightly until now.
I would like to fix it once and for all.
*EDIT*
Sorry for asking. It was easy to find out!
The size of a texture is the number of pixels.
So, now I can see it has messed up my calculations.
When I make a rect to represent the boundary of the texture, the rect size is the number of pixels minus 1, since the end points are considered as pixels.
Does anyone understand what I mean?


