Here's a simple method for checking whether or not two panels overlap:
PANEL* pan_one =
{
...
}
PANEL* pan_two =
{
...
}
...
if( ( pan_one.pos_x + pan_one.size_x >= pan_two.pos_x ) || ( pan_one.pos_x <= pan_two.pos_x + pan_two.size_x ) ) // overlapping in x dimension
if( ( pan_one.pos_y + pan_one.size_y >= pan_two.pos_y ) || ( pan_one.pos_y <= pan_two.pos_y + pan_two.size_y ) ) // overlapping in y dimension
{
// now we know both panels are overlapping in both the x and y dimension!
// now destroy panels, etc.
}
If you have any questions, fire away
