#ifndef ENV_H
#define ENV_H

#include "lp_vector2.h"

class Env
{
public:
  Env(float aLeft, float aRight, float aTop, float aBottom)
  : left(aLeft)
  , right(aRight)
  , top(aTop)
  , bottom(aBottom)
  {
  }

  bool Collide(LP_Vector2& pos)
  {
    bool collided = false;

    if(pos.x < left)
    {
      pos.x = left;
      collided = true;
    }
    else if(pos.x > right)
    {
      pos.x = right;
      collided = true;
    }
    if(pos.y < top)
    {
      pos.y = top;
      collided = true;
    }
    else if(pos.y > bottom)
    {
      pos.y = bottom;
      collided = true;
    }

    return collided;
  }

private:
    float left, right, top, bottom;
};

#endif
