using GraphicsManager.Enums;
using GraphicsManager.Interfaces;
using GraphicsManager.Objects;

namespace Luski.GUI.MainScreen.UI.LuskiControls;

public class CenterFullScreenBase : UserControl
{
    private IRenderObject centerobj;
    public CenterFullScreenBase(IRenderObject obj, bool Streach = false)
    {
        centerobj = obj;
        if (!Streach) obj.Anchor = ObjectAnchor.Prevent;
        else obj.Anchor = ObjectAnchor.All;
        Controls.Add(obj);
        base.BackgroundColor = new(0, 0, 0, 130);
        Anchor = ObjectAnchor.All;
    }

    public override void LoadToParent(IParent p, IWindow w)
    {
        base.SetSize(w.CS.X, w.CS.Y);
        centerobj.SetLocation((w.CS.X - centerobj.Size.X)/2, (w.CS.Y - centerobj.Size.Y)/2);
        centerobj.ForceDistanceUpdate(this);
        base.LoadToParent(p, w);
    }
}