Hi,
I was expecting (and very much hoping) that the Rect class would take into account the Panel hierarchy when using isPointInRect. However, it seems that even though the Rect will be drawn relative to it's Panel, the point checking considers the Rect's coordinates to be absolute.
Is my understanding/attempt correct? And if so, is this desirable behavior? Maybe my approach is way off? I'm also fairly new to c/c++ so please forgive any odd coding attempt.
Thanks.
I was expecting (and very much hoping) that the Rect class would take into account the Panel hierarchy when using isPointInRect. However, it seems that even though the Rect will be drawn relative to it's Panel, the point checking considers the Rect's coordinates to be absolute.
Is my understanding/attempt correct? And if so, is this desirable behavior? Maybe my approach is way off? I'm also fairly new to c/c++ so please forgive any odd coding attempt.
Thanks.
- Code:
//onInit()
basePanel = Panel(pBackBuffer);
basePanel.addChild(&menuPanel;, Utility::Rect(50, 500, 400, 600));
projButton = Utility::Rect(5,5,50,50);
...
//onNextFrame()
//draws rect at bottom left of screen (relative coords)
application->menuPanel.drawRect(RGB(100,100,100), &application-;>projButton);
...
//onStylusDown()
//"if" only true when I tap upper left of screen (absolute coords)
if (application->projButton.isPointInRect(p)) {
return 1;
}
return 0;
...