Rect functions

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
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Rect functions

Post by Tyn »

Hey

I'm trying to understand how the rect functions work, specifically isPointInside. If I draw an image and then I want to check if a pixel is inside the box this image is drawn in I would use this function right? I was reading the documentation but I couldn't see anything like a place for any ID. Is there some kind of ID like there is for GUI elements, or is it called in a different way? Kinda confused here :oops:
madinitaly
Posts: 92
Joined: Sat Nov 29, 2003 8:30 pm
Contact:

Post by madinitaly »

Maybe I didn't understand what do you mean, but there's no need for an ID. You create an instance of irr::core::rect, then call the method to see if the given point is inside the caller rectangle.

Code: Select all

irr::core::rect<s32> R[4];
irr::core::position2d<s32> Pos;
(...)
for (u16 i = 0; i < 4; i++)
if R[i].isPointInside (Pos)
{
printf ("Point is inside rectangle %d.\n", i);
break;
}
Post Reply