Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| abdb78eae7 | |||
| 99a853f35d | |||
| 3d0f15af45 | |||
| 01d7f27dc7 | |||
| 7bf7b6c53c |
@@ -21,7 +21,6 @@ namespace Dashboard.BlurgText.OpenGL
|
||||
private int _vertexArray = 0;
|
||||
|
||||
public override Blurg Blurg { get; }
|
||||
public bool SystemFontsEnabled { get; set; }
|
||||
public bool IsDisposed { get; private set; } = false;
|
||||
|
||||
public override string DriverName => "BlurgText";
|
||||
@@ -33,7 +32,7 @@ namespace Dashboard.BlurgText.OpenGL
|
||||
public BlurgGLExtension()
|
||||
{
|
||||
Blurg = new Blurg(AllocateTexture, UpdateTexture);
|
||||
SystemFontsEnabled = Blurg.EnableSystemFonts();
|
||||
Application.ExtensionRequire<BlurgTextExtension>().Loader.Configure(Blurg);
|
||||
}
|
||||
|
||||
~BlurgGLExtension()
|
||||
|
||||
@@ -6,20 +6,21 @@ using Dashboard.Pal;
|
||||
|
||||
namespace Dashboard.BlurgText
|
||||
{
|
||||
public interface IBlurgDcExtensionFactory
|
||||
public interface IBlurgTextLoader
|
||||
{
|
||||
public void Configure(Blurg blurg);
|
||||
public BlurgDcExtension CreateExtension(BlurgTextExtension appExtension, DeviceContext dc);
|
||||
}
|
||||
|
||||
public class BlurgTextExtension(IBlurgDcExtensionFactory dcExtensionFactory) : IFontLoader
|
||||
public class BlurgTextExtension(IBlurgTextLoader loader) : IFontLoader
|
||||
{
|
||||
private readonly Blurg _blurg = new Blurg(GlobalTextureAllocation, GlobalTextureUpdate);
|
||||
|
||||
public Application Context { get; private set; } = null!;
|
||||
public string DriverName { get; } = "BlurgText";
|
||||
public string DriverVendor { get; } = "Dashbord and BlurgText";
|
||||
public string DriverVendor { get; } = "Dashboard and BlurgText";
|
||||
public Version DriverVersion { get; } = new Version(1, 0);
|
||||
public IBlurgDcExtensionFactory DcExtensionFactory { get; } = dcExtensionFactory;
|
||||
public IBlurgTextLoader Loader { get; } = loader;
|
||||
IContextBase IContextExtensionBase.Context => Context;
|
||||
public bool IsDisposed { get; private set; } = false;
|
||||
|
||||
@@ -27,14 +28,14 @@ namespace Dashboard.BlurgText
|
||||
{
|
||||
Context = context;
|
||||
context.DeviceContextCreated += OnDeviceContextCreated;
|
||||
_blurg.EnableSystemFonts();
|
||||
Loader.Configure(_blurg);
|
||||
}
|
||||
|
||||
void IContextExtensionBase.Require(IContextBase context) => Require((Application)context);
|
||||
|
||||
private void RequireDeviceContextExtension(DeviceContext dc)
|
||||
{
|
||||
dc.ExtensionPreload<BlurgDcExtension>(() => DcExtensionFactory.CreateExtension(this, dc));
|
||||
dc.ExtensionPreload<BlurgDcExtension>(() => Loader.CreateExtension(this, dc));
|
||||
}
|
||||
|
||||
private void OnDeviceContextCreated(object? sender, DeviceContext dc)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BlurgText" Version="0.1.0-nightly-33" />
|
||||
<PackageReference Include="BlurgText" Version="0.1.0" />
|
||||
<ProjectReference Include="..\Dashboard.Common\Dashboard.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Dashboard.OpenGL.Drawing
|
||||
{
|
||||
if (_vao == -1)
|
||||
{
|
||||
GL.CreateVertexArray(out _vao);
|
||||
GL.GenVertexArray(out _vao);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -462,7 +462,6 @@ namespace Dashboard.OpenGL.Drawing
|
||||
call.SetStencilMode();
|
||||
call.SetPrimitiveRestart();
|
||||
call.SetColorMask();
|
||||
call.SetDepthMode();
|
||||
call.SetPointSize();
|
||||
call.SetLineWidth();
|
||||
call.UseTextures();
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace Dashboard.OpenGL
|
||||
public BufferAccessPattern AccessPattern { get; } = pattern;
|
||||
public long Size { get; private set; } = size;
|
||||
public long Offset { get; private set; } = offset;
|
||||
public int Handle { get; private set; }
|
||||
public int Handle { get; private set; } = handle;
|
||||
|
||||
public void Reallocate(long newSize)
|
||||
{
|
||||
GL.CreateBuffer(out int handle);
|
||||
GL.GenBuffer(out int handle);
|
||||
GL.BindBuffer(BufferTarget.ArrayBuffer, handle);
|
||||
GL.BufferData(BufferTarget.ArrayBuffer, (nint)newSize, (nint)0, AccessPattern switch
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dashboard.BlurgText;
|
||||
using BlurgText;
|
||||
using Dashboard.BlurgText;
|
||||
using Dashboard.BlurgText.OpenGL;
|
||||
using Dashboard.Controls;
|
||||
using Dashboard.Drawing;
|
||||
@@ -52,7 +53,7 @@ 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";
|
||||
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);
|
||||
@@ -133,10 +134,15 @@ window.EventRaised += (sender, eventArgs) =>
|
||||
app.Run(true, source.Token);
|
||||
|
||||
|
||||
class BlurgTextExtensionFactory : IBlurgDcExtensionFactory
|
||||
class BlurgTextExtensionFactory : IBlurgTextLoader
|
||||
{
|
||||
public BlurgDcExtension CreateExtension(BlurgTextExtension appExtension, DeviceContext dc)
|
||||
{
|
||||
return new BlurgGLExtension();
|
||||
}
|
||||
|
||||
public void Configure(Blurg blurg)
|
||||
{
|
||||
blurg.EnableSystemFonts();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user