#pragma once

namespace widget {

  struct bounding_box {
    float _x;
    float _y;
    float width;
    float height;
    float dx;
    float dy;

    constexpr inline bounding_box(float __x, float __y, float _width, float _height)
      : _x(__x), _y(__y), width(_width), height(_height), dx(0), dy(0)
    { }

    constexpr inline float x()
    {
      return dx + _x;
    }

    constexpr inline float y()
    {
      return dy + _y;
    }

    constexpr inline bool inside(float __x, float __y)
    {
      return
           (__x >= x())
        && (__y >= y())
        && (__x <= (x() + width))
        && (__y <= (y() + height))
        ;
    }
  };
}
