Add a configure blurg method to the extension factory interface.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user