diff --git a/GraphicsManager/Enums/ObjectAnchor.cs b/GraphicsManager/Enums/ObjectAnchor.cs
new file mode 100644
index 0000000..f693894
--- /dev/null
+++ b/GraphicsManager/Enums/ObjectAnchor.cs
@@ -0,0 +1,10 @@
+namespace GraphicsManager.Enums;
+
+public enum ObjectAnchor
+{
+ Left = 0b_0001,
+ Top = 0b_0010,
+ Right = 0b_0100,
+ Bottom = 0b_1000,
+ All = Left | Top | Right | Bottom,
+}
diff --git a/GraphicsManager/GraphicsManager.csproj b/GraphicsManager/GraphicsManager.csproj
new file mode 100644
index 0000000..fd26c9e
--- /dev/null
+++ b/GraphicsManager/GraphicsManager.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GraphicsManager/Interfaces/IParent.cs b/GraphicsManager/Interfaces/IParent.cs
new file mode 100644
index 0000000..6ac1561
--- /dev/null
+++ b/GraphicsManager/Interfaces/IParent.cs
@@ -0,0 +1,18 @@
+using OpenTK.Mathematics;
+using OpenTK.Windowing.Common;
+
+namespace GraphicsManager.Interfaces;
+
+public interface IParent
+{
+ public Vector2i Size { get; }
+ public void Resize(ResizeEventArgs e);
+ public float[] RctToFloat(int x, int y, int Width, int Height, bool hastexture = false, float z = 0.0f);
+ public float IntToFloat(int p, bool Invert = false);
+ public float FloatToInt(float p, bool Invert = false);
+ public event Action MouseDown;
+ public event Action KeyDown;
+ public Vector2 MousePosition { get; }
+
+ public Vector2i Position { get; }
+}
diff --git a/GraphicsManager/Interfaces/IRenderObject.cs b/GraphicsManager/Interfaces/IRenderObject.cs
new file mode 100644
index 0000000..310e380
--- /dev/null
+++ b/GraphicsManager/Interfaces/IRenderObject.cs
@@ -0,0 +1,23 @@
+using GraphicsManager.Enums;
+using OpenTK.Mathematics;
+
+namespace GraphicsManager.Interfaces;
+
+public interface IRenderObject
+{
+ public ObjectAnchor Anchor { get; set; }
+ public bool Loaded { get; }
+ public void LoadToParent(IParent Parent, Window Window);
+ public void Draw();
+ public void Clean();
+ public Vector2i Size { get; set; }
+ public Vector2i Location { get; set; }
+ public Vector2 SizeAsFloat { get; }
+ public Vector2 LocationAsFloat { get; }
+ public Vector2i Distance { get; }
+ public IParent? Parent { get; }
+ public Window? Window { get; }
+ public bool Visible { get; set; }
+
+ public event Func? Clicked;
+}
diff --git a/GraphicsManager/Interfaces/ITextureObject.cs b/GraphicsManager/Interfaces/ITextureObject.cs
new file mode 100644
index 0000000..4fb3848
--- /dev/null
+++ b/GraphicsManager/Interfaces/ITextureObject.cs
@@ -0,0 +1,13 @@
+using GraphicsManager.Objects.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GraphicsManager.Interfaces;
+
+public interface ITextureObject : IRenderObject
+{
+ public Texture? Texture { get; }
+}
diff --git a/GraphicsManager/Objects/Core/Font.cs b/GraphicsManager/Objects/Core/Font.cs
new file mode 100644
index 0000000..35918a7
--- /dev/null
+++ b/GraphicsManager/Objects/Core/Font.cs
@@ -0,0 +1,59 @@
+using System.Reflection;
+
+namespace GraphicsManager.Objects.Core;
+
+public class Font
+{
+ public void SetEmbeddedFont(string Font, Assembly? Assembly = null)
+ {
+ _ = Font ?? throw new ArgumentNullException(nameof(Font));
+ this.Assembly = Assembly;
+ this.Embeded = true;
+ this.Name = Font;
+ }
+
+ public static Font MakeEmbeddedFont(string Font, Assembly? Assembly = null)
+ {
+ _ = Font ?? throw new ArgumentNullException(nameof(Font));
+ return new Font()
+ {
+ Assembly = Assembly,
+ Embeded = true,
+ Name = Font,
+ };
+ }
+
+ public static Font MakeFontFromFile(string Font)
+ {
+ _ = Font ?? throw new ArgumentNullException(nameof(Font));
+ return new Font()
+ {
+ Assembly = null,
+ Embeded = false,
+ Name = Font,
+ };
+ }
+
+ public void SetFontFile(string Font)
+ {
+ _ = Font ?? throw new ArgumentNullException(nameof(Font));
+ this.Assembly = null;
+ this.Embeded = false;
+ this.Name = Font;
+ }
+
+ public byte[] GetData()
+ {
+ if (Embeded)
+ {
+ string Base = "GraphicsManager.Resources.Fonts.";
+ if (Assembly is not null) Base = string.Empty;
+ return (Assembly is null ? Tools.GetResourceBytes(Base + Name) : Tools.GetResourceBytes(Assembly!, $"{Base}{Name}"));
+ }
+ return File.ReadAllBytes(Name);
+ }
+
+ public string Name { get; private set; } = "shal be default";
+ public bool Embeded { get; private set; }
+ public Assembly? Assembly { get; private set; }
+}
diff --git a/GraphicsManager/Objects/Core/Shader.cs b/GraphicsManager/Objects/Core/Shader.cs
new file mode 100644
index 0000000..8d79551
--- /dev/null
+++ b/GraphicsManager/Objects/Core/Shader.cs
@@ -0,0 +1,129 @@
+using OpenTK.Graphics.OpenGL4;
+using System.Reflection;
+
+namespace GraphicsManager.Objects.Core;
+
+public class Shader : IDisposable
+{
+ public int Handle { get; }
+ private readonly int VertexShader;
+ private readonly int FragmentShader;
+ private bool disposedValue = false;
+
+ public Shader(string VertexShaderSource, string FragmentShaderSource, bool VertextBuiltIn = false, bool FragmentShaderBuiltIn = false, Assembly? Assembly = null)
+ {
+ VertexShader = GL.CreateShader(ShaderType.VertexShader);
+ string Base = "GraphicsManager.Resources.Shaders.";
+ if (Assembly is not null) Base = string.Empty;
+ string vss = (VertextBuiltIn ? Tools.GetResourceString((Assembly == null ? typeof(Tools).Assembly : Assembly), $"{Base}{VertexShaderSource}") : File.ReadAllText(VertexShaderSource))!;
+ string fss = (FragmentShaderBuiltIn ? Tools.GetResourceString((Assembly ?? typeof(Tools).Assembly), $"{Base}{FragmentShaderSource}") : File.ReadAllText(FragmentShaderSource))!;
+ GL.ShaderSource(VertexShader, vss);
+
+ FragmentShader = GL.CreateShader(ShaderType.FragmentShader);
+ GL.ShaderSource(FragmentShader, fss);
+
+ GL.CompileShader(VertexShader);
+
+ string infoLogVert = GL.GetShaderInfoLog(VertexShader);
+ if (infoLogVert != string.Empty)
+ Console.WriteLine(infoLogVert);
+
+ GL.CompileShader(FragmentShader);
+
+ string infoLogFrag = GL.GetShaderInfoLog(FragmentShader);
+
+ if (infoLogFrag != string.Empty)
+ Console.WriteLine(infoLogFrag);
+
+ Handle = GL.CreateProgram();
+
+ GL.AttachShader(Handle, VertexShader);
+ GL.AttachShader(Handle, FragmentShader);
+
+ GL.LinkProgram(Handle);
+
+ GL.DetachShader(Handle, VertexShader);
+ GL.DetachShader(Handle, FragmentShader);
+ GL.DeleteShader(FragmentShader);
+ GL.DeleteShader(VertexShader);
+ }
+
+ public Shader(string ShaderSource, bool Embeded = false, Assembly? Assembly = null)
+ {
+ VertexShader = GL.CreateShader(ShaderType.VertexShader);
+ string Base = "GraphicsManager.Resources.Shaders.";
+ if (Assembly is not null) Base = string.Empty;
+ GL.ShaderSource(VertexShader, (Embeded ? Tools.GetResourceString((Assembly ?? typeof(Tools).Assembly), $"{Base}{ShaderSource}.vert") : File.ReadAllText($"{ShaderSource}.vert")));
+
+ FragmentShader = GL.CreateShader(ShaderType.FragmentShader);
+ GL.ShaderSource(FragmentShader, (Embeded ? Tools.GetResourceString((Assembly ?? typeof(Tools).Assembly), $"{Base}{ShaderSource}.frag") : File.ReadAllText($"{ShaderSource}.frag")));
+
+ GL.CompileShader(VertexShader);
+
+ string infoLogVert = GL.GetShaderInfoLog(VertexShader);
+ if (infoLogVert != string.Empty)
+ Console.WriteLine(infoLogVert);
+
+ GL.CompileShader(FragmentShader);
+
+ string infoLogFrag = GL.GetShaderInfoLog(FragmentShader);
+
+ if (infoLogFrag != string.Empty)
+ Console.WriteLine(infoLogFrag);
+
+ Handle = GL.CreateProgram();
+
+ GL.AttachShader(Handle, VertexShader);
+ GL.AttachShader(Handle, FragmentShader);
+
+ GL.LinkProgram(Handle);
+
+ GL.DetachShader(Handle, VertexShader);
+ GL.DetachShader(Handle, FragmentShader);
+ GL.DeleteShader(FragmentShader);
+ GL.DeleteShader(VertexShader);
+ }
+
+ public void Use()
+ {
+ GL.UseProgram(Handle);
+ }
+
+ public int GetAttribLocation(string attribName)
+ {
+ return GL.GetAttribLocation(Handle, attribName);
+ }
+
+ public void SetInt(string name, int value)
+ {
+ int location = GL.GetUniformLocation(Handle, name);
+
+ GL.Uniform1(location, value);
+ }
+
+ public Shader Clone()
+ {
+ return (Shader)MemberwiseClone();
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
+ {
+ GL.DeleteProgram(Handle);
+
+ disposedValue = true;
+ }
+ }
+
+ ~Shader()
+ {
+ GL.DeleteProgram(Handle);
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+}
diff --git a/GraphicsManager/Objects/Core/Texture.cs b/GraphicsManager/Objects/Core/Texture.cs
new file mode 100644
index 0000000..d0e95a4
--- /dev/null
+++ b/GraphicsManager/Objects/Core/Texture.cs
@@ -0,0 +1,106 @@
+using GraphicsManager.Structs;
+using OpenTK.Graphics.OpenGL4;
+using OpenTK.Mathematics;
+using SharpFont;
+using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
+using Image = SixLabors.ImageSharp.Image;
+
+namespace GraphicsManager.Objects.Core;
+
+public class Texture
+{
+ public static readonly Shader TextureShader = new("RectangleTexture", true);
+
+ public int handel;
+ public Texture(byte[] File)
+ {
+ Image image = Image.Load(File);
+ image.Mutate(x => x.Flip(FlipMode.Vertical));
+
+ var pixels = new List(4 * image.Width * image.Height);
+
+ for (int y = 0; y < image.Height; y++)
+ {
+ var row = image.GetPixelRowSpan(y);
+
+ for (int x = 0; x < image.Width; x++)
+ {
+ pixels.Add(row[x].R);
+ pixels.Add(row[x].G);
+ pixels.Add(row[x].B);
+ pixels.Add(row[x].A);
+ }
+ }
+
+ handel = GL.GenTexture();
+ GL.BindTexture(TextureTarget.Texture2D, handel);
+ GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, image.Width, image.Height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, pixels.ToArray());
+ GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
+ GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
+ }
+
+ internal Texture(Label l, char charter, uint PixelHeight, Face face)
+ {
+ if (!Label._characters.ContainsKey(l)) Label._characters.Add(l, new Dictionary());
+ face.SetPixelSizes(0, PixelHeight);
+
+ GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
+
+ GL.ActiveTexture(TextureUnit.Texture0);
+ face.SelectCharmap(Encoding.Unicode);
+ ushort temp = ((ushort)charter);
+
+ try
+ {
+ face.LoadChar(temp, LoadFlags.Render, LoadTarget.Normal);
+ GlyphSlot glyph = face.Glyph;
+ FTBitmap bitmap = glyph.Bitmap;
+
+ handel = GL.GenTexture();
+ GL.BindTexture(TextureTarget.Texture2D, handel);
+ GL.TexImage2D(TextureTarget.Texture2D, 0,
+ PixelInternalFormat.R8, bitmap.Width, bitmap.Rows, 0,
+ PixelFormat.Red, PixelType.UnsignedByte, bitmap.Buffer);
+
+
+ Character cha = new()
+ {
+ Size = new Vector2(bitmap.Width, bitmap.Rows),
+ Bearing = new Vector2(glyph.BitmapLeft, glyph.BitmapTop),
+ Advance = (int)glyph.Advance.X.Value,
+ Texture = this,
+ };
+
+ Label._characters[l].Add(temp, cha);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex);
+ }
+ }
+
+ public void LoadText()
+ {
+ GL.TextureParameter(handel, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
+ GL.TextureParameter(handel, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
+ GL.TextureParameter(handel, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
+ GL.TextureParameter(handel, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);
+ }
+
+ public void Load(int loc)
+ {
+ GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
+ GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);
+ GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
+ GL.EnableVertexAttribArray(loc);
+ GL.VertexAttribPointer(loc, 2, VertexAttribPointerType.Float, false, 5 * sizeof(float), 3 * sizeof(float));
+ }
+
+ public void Use(TextureUnit unit = TextureUnit.Texture0)
+ {
+ GL.ActiveTexture(unit);
+ GL.BindTexture(TextureTarget.Texture2D, handel);
+ }
+}
diff --git a/GraphicsManager/Objects/Label.cs b/GraphicsManager/Objects/Label.cs
new file mode 100644
index 0000000..12e6dc8
--- /dev/null
+++ b/GraphicsManager/Objects/Label.cs
@@ -0,0 +1,214 @@
+using GraphicsManager.Enums;
+using GraphicsManager.Interfaces;
+using GraphicsManager.Objects.Core;
+using GraphicsManager.Structs;
+using OpenTK.Graphics.OpenGL4;
+using OpenTK.Mathematics;
+using SharpFont;
+using System.Reflection;
+using Encoding = SharpFont.Encoding;
+
+namespace GraphicsManager.Objects;
+
+public class Label : IRenderObject
+{
+ public static readonly Shader DefaultTextShader = new("Label", true);
+ public IParent? Parent { get; private set; }
+ public ObjectAnchor Anchor { get; set; } = ObjectAnchor.Left | ObjectAnchor.Top;
+ private Vector2 laf = new(), saf = new();
+
+ public Vector2 LocationAsFloat { get { return laf; } }
+ public Vector2 SizeAsFloat { get { return saf; } }
+ public bool Visible { get; set; } = true;
+
+ public static readonly Dictionary