overlapComponent method

bool overlapComponent(
  1. PositionComponent c
)

Implementation

bool overlapComponent(PositionComponent c) {
  double left = c.position.x;
  double top = c.position.y;
  double right = c.position.x + c.size.x;
  double bottom = c.position.y + c.size.y;
  if (this.right <= left || right <= this.left) {
    return false;
  }
  if (this.bottom <= top || bottom <= this.top) {
    return false;
  }
  return true;
}