protected virtual void ApplyCamera(Camera camera)
 {
     x += camera.x;
     y += camera.y;
     outOfSight = x < 0 || x > Constants.Constants.WIDTH || y < 0 ||
         y > Constants.Constants.HEIGHT;
 }
 public Menu(List<MenuObject> _objects, MenuLayout _layout, int _startX = 0, int _startY=50)
 {
     camera = new Camera ();
     startX = _startX;
     startY = _startY;
     layout = _layout;
     objects = _objects;
     if (layout == MenuLayout.Vertical) {
         int y = startY;
         foreach (MenuObject obj in objects) {
             int x = Constants.Constants.WIDTH / 2 - obj.width / 2;
             if (startX != 0) {
                 x = startX;
             }
             obj.x = x;
             obj.y = y;
             y += obj.height + 20;
         }
         width = objects [0].width;
         height = y;
         if (y >= Constants.Constants.HEIGHT - objects [0].height) {
             yOverflow = true;
             height = Constants.Constants.HEIGHT;
         }
     } else if (layout == MenuLayout.Horizontal) {
         int y = startY;
         int x = startX;
         foreach (MenuObject obj in objects) {
             obj.x = x;
             obj.y = y;
             x += obj.width + 10;
         }
         width = x;
         if (x >= Constants.Constants.WIDTH - objects [0].width) {
             xOverflow = true;
             x = Constants.Constants.WIDTH;
         }
     }
     objects [0].selected = true;
 }
 public override void Update(float elapsed, Camera camera)
 {
     base.Update (elapsed, camera);
     if (lastSelected != selected) {
         RenderText ();
         lastSelected = selected;
     }
 }
 public virtual void Update(float elapsed, Camera c)
 {
     ApplyCamera (c);
 }
 public void Update(float elapsed, Camera _camera=null)
 {
     if (_camera != null) {
         camera.x += _camera.x;
         camera.y += _camera.y;
     }
     lastSelectChange += elapsed;
     HandleInput ();
     objects [selected].selected = true;
     foreach (MenuObject m in objects) {
         m.Update (elapsed, camera);
     }
 }