using BlurgText; using Dashboard.BlurgText; using Dashboard.BlurgText.OpenGL; using Dashboard.Controls; using Dashboard.Drawing; using Dashboard.Events; using Dashboard.OpenGL; using Dashboard.OpenTK.PAL2; using Dashboard.Pal; using Dashboard.StbImage; using OpenTK.Graphics.OpenGL; using OpenTK.Mathematics; using OpenTK.Platform; using TK = OpenTK.Platform.Toolkit; Application app = new Pal2Application(new ToolkitOptions() { ApplicationName = "DashTerm", Windows = new ToolkitOptions.WindowsOptions() { EnableVisualStyles = true, IsDPIAware = true, }, FeatureFlags = ToolkitFlags.EnableOpenGL, }) { GraphicsApiHints = new OpenGLGraphicsApiHints() { Version = new Version(4, 1), ForwardCompatibleFlag = true, DebugFlag = true, Profile = OpenGLProfile.Core, sRGBFramebuffer = true, SwapMethod = ContextSwapMethod.Undefined, RedColorBits = 8, GreenColorBits = 8, BlueColorBits = 8, AlphaColorBits = 8, Multisamples = 0, SupportTransparentFramebufferX11 = true, } }; CancellationTokenSource source = new CancellationTokenSource(); app.Initialize(); app.ExtensionRequire(); app.ExtensionLoad(new BlurgTextExtension(new BlurgTextExtensionFactory())); PhysicalWindow window = (PhysicalWindow)app.CreatePhysicalWindow(); MessageBox box = MessageBox.Create(window, "Are you sure you want to exit?", "Confirm Exit", MessageBoxIcon.Question, MessageBoxButtons.YesNo); window.Title = "DashTerm"; TK.Window.SetMinClientSize(window.WindowHandle, 300, 200); TK.Window.SetClientSize(window.WindowHandle, new Vector2i(320, 240)); TK.Window.SetBorderStyle(window.WindowHandle, WindowBorderStyle.ResizableBorder); // TK.Window.SetTransparencyMode(wnd, WindowTransparencyMode.TransparentFramebuffer, 0.1f); GLDeviceContext context = (GLDeviceContext)window.DeviceContext; context.GLContext.MakeCurrent(); context.GLContext.SwapGroup.SwapInterval = 1; GL.Disable(EnableCap.DepthTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); GL.ColorMask(true, true, true, true); TK.Window.SetMode(window.WindowHandle, WindowMode.Normal); window.DeviceContext.ExtensionRequire().ScaleOverride = 1.5f; IDirectRendering direct = window.DeviceContext.ExtensionRequire(); IImmediateMode imm = window.DeviceContext.ExtensionRequire(); ImmediateVertex[] vertices = new ImmediateVertex[] { // x, y, z, r, g, b, a new ImmediateVertex(new System.Numerics.Vector3(-0.5f, -0.5f, 0.0f), System.Numerics.Vector2.Zero, new System.Numerics.Vector4(1, 0, 0, 1)), new ImmediateVertex(new System.Numerics.Vector3(+0.5f, -0.5f, 0.0f), System.Numerics.Vector2.Zero, new System.Numerics.Vector4(0, 1, 0, 1)), new ImmediateVertex(new System.Numerics.Vector3(+0.0f, +0.5f, 0.0f), System.Numerics.Vector2.Zero, new System.Numerics.Vector4(0, 0, 1, 1)), }; window.EventRaised += (sender, eventArgs) => { if (eventArgs is not PaintEventArgs paint) return; imm.DrawImmediate(new ImmediateDrawCall(MeshPrimitive.Triangle, vertices.AsMemory())); }; app.Run(true, source.Token); class BlurgTextExtensionFactory : IBlurgTextLoader { public BlurgDcExtension CreateExtension(BlurgTextExtension appExtension, DeviceContext dc) { return new BlurgGLExtension(); } public void Configure(Blurg blurg) { blurg.EnableSystemFonts(); } };