using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace Slayter
{
    class ClickableObject: Background,IDrawable
    {
        private DelegateClass func;
        public ClickableObject(Texture2D t, Rectangle r,DelegateClass f)
           :base(t,r){
               func = f;
        }

        public Boolean isClicked(MouseState state)
        {
            return Rect.X <= state.X && (Rect.X + Rect.Width) >= state.X &&
                        Rect.Y <= state.Y && (Rect.Y + Rect.Height) >= state.Y;
        }

        public void Click(Game1 game)
        {
            func(game);
        }
    }
}
