using Microsoft.Xna.Framework;
using MonoGame.FourEngine.Entities;
using MonoGame.FourEngine.Resources;
using MonoGame.FourEngine.Sample.Win32.Scenes;

namespace MonoGame.FourEngine.Sample.Win32.Entities
{
    public class MouseEntity : BasicEntity
    {
        protected override SpriteDefinition SpriteDefinition
            => new SpriteDefinition
            {
                FileName = Resources.Sprites.MouseSprite,
                Size = new Point(20)
            };

        public override void OnUpdate(UpdateEventArgs args)
        {
            base.OnUpdate(args);
            SpriteComponent.Position = ServiceLocator.PointerControl.Position;
            if (args.Scene is TestScene scene)
            {
                scene.Camera.Components[0].Position = new Point(Position.X / 2, Position.Y / 2);
            }
        }
    }
}