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
Rect functions
Rect functions
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
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
-
madinitaly
- Posts: 92
- Joined: Sat Nov 29, 2003 8:30 pm
- Contact:
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;
}