using GraphicsManager.Interfaces;
using GraphicsManager.Objects;
using GraphicsManager.Objects.Core;
using GraphicsManager.Structs;
using OpenTK.Graphics.OpenGL4;
using OpenTK.Mathematics;

namespace Luski.GUI.MainScreen.UI.LuskiControls;

public class BasicGradientLabel : AdvancedGradientLabel
{
    public BasicGradientLabel(FontInteraction fi) : base(fi) { }
    public Color4 LeftColor
    {
	    get => Colors[0];
	    set => Colors[0] = value;
    }
    public Color4 RightColor
    {
	    get => Colors[1];
	    set => Colors[1] = value;
    }
    protected override Color4 getcol(int pos)
    {
	    float t = Math.Clamp(pos/(float)Size.X, 0, 1);

	    float r = LeftColor.R + (RightColor.R - LeftColor.R) * t;
	    float g = LeftColor.G + (RightColor.G - LeftColor.G) * t;
	    float b = LeftColor.B + (RightColor.B - LeftColor.B) * t;
	    float a = LeftColor.A + (RightColor.A - LeftColor.A) * t;

	    return new Color4(r, g, b, a);
    }
}