using Microsoft.Xna.Framework;
using MonoGame.FourEngine;
using MonoGame.FourEngine.Attributes;
using Rotor.Win32.Entities;

namespace Rotor.Win32.Scenes
{
    [Default]
    public class RootScene : Scene
    {
        private Text _text;
        private RotatableScene _cube;
        private Mouse _mouse;
        private FpsCounter _fps;

        public RootScene()
        {
            DrawingSurface<RotatableScene> surface;
            AddEntity(surface = new DrawingSurface<RotatableScene>(100,100));
            AddEntity(_text = new Text() { Color = Color.Black });
            AddEntity(_mouse = new Mouse());
            AddEntity(_fps = new FpsCounter());
            _cube = surface.Scene;
        }

        public override void OnDraw(DrawEventArgs args)
        {
            base.OnDraw(args);
            _text.Text =
$@"Mouse: [{_mouse.Position.X}; {_mouse.Position.Y}]

Rotation: {_cube.Rotation}
Translation: [{_cube.Translation.X}; {_cube.Translation.Y}]
Scaling: {_cube.Scaling}

FPS: {_fps.Frames}";
        }

        public override void OnUpdate(UpdateEventArgs args)
        {
            var pointer = args.Pointer.Clone();
            pointer.Position = new Point(102, 10);
            base.OnUpdate(args);
        }

        public override void OnClear(ClearEventArgs args)
        {
            args.Color = Color.White;
        }
    }
}