Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| abdb78eae7 | |||
| 99a853f35d | |||
| 3d0f15af45 | |||
| 01d7f27dc7 | |||
| 7bf7b6c53c |
@@ -21,7 +21,6 @@ namespace Dashboard.BlurgText.OpenGL
|
|||||||
private int _vertexArray = 0;
|
private int _vertexArray = 0;
|
||||||
|
|
||||||
public override Blurg Blurg { get; }
|
public override Blurg Blurg { get; }
|
||||||
public bool SystemFontsEnabled { get; set; }
|
|
||||||
public bool IsDisposed { get; private set; } = false;
|
public bool IsDisposed { get; private set; } = false;
|
||||||
|
|
||||||
public override string DriverName => "BlurgText";
|
public override string DriverName => "BlurgText";
|
||||||
@@ -33,7 +32,7 @@ namespace Dashboard.BlurgText.OpenGL
|
|||||||
public BlurgGLExtension()
|
public BlurgGLExtension()
|
||||||
{
|
{
|
||||||
Blurg = new Blurg(AllocateTexture, UpdateTexture);
|
Blurg = new Blurg(AllocateTexture, UpdateTexture);
|
||||||
SystemFontsEnabled = Blurg.EnableSystemFonts();
|
Application.ExtensionRequire<BlurgTextExtension>().Loader.Configure(Blurg);
|
||||||
}
|
}
|
||||||
|
|
||||||
~BlurgGLExtension()
|
~BlurgGLExtension()
|
||||||
|
|||||||
@@ -6,20 +6,21 @@ using Dashboard.Pal;
|
|||||||
|
|
||||||
namespace Dashboard.BlurgText
|
namespace Dashboard.BlurgText
|
||||||
{
|
{
|
||||||
public interface IBlurgDcExtensionFactory
|
public interface IBlurgTextLoader
|
||||||
{
|
{
|
||||||
|
public void Configure(Blurg blurg);
|
||||||
public BlurgDcExtension CreateExtension(BlurgTextExtension appExtension, DeviceContext dc);
|
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);
|
private readonly Blurg _blurg = new Blurg(GlobalTextureAllocation, GlobalTextureUpdate);
|
||||||
|
|
||||||
public Application Context { get; private set; } = null!;
|
public Application Context { get; private set; } = null!;
|
||||||
public string DriverName { get; } = "BlurgText";
|
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 Version DriverVersion { get; } = new Version(1, 0);
|
||||||
public IBlurgDcExtensionFactory DcExtensionFactory { get; } = dcExtensionFactory;
|
public IBlurgTextLoader Loader { get; } = loader;
|
||||||
IContextBase IContextExtensionBase.Context => Context;
|
IContextBase IContextExtensionBase.Context => Context;
|
||||||
public bool IsDisposed { get; private set; } = false;
|
public bool IsDisposed { get; private set; } = false;
|
||||||
|
|
||||||
@@ -27,14 +28,14 @@ namespace Dashboard.BlurgText
|
|||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
context.DeviceContextCreated += OnDeviceContextCreated;
|
context.DeviceContextCreated += OnDeviceContextCreated;
|
||||||
_blurg.EnableSystemFonts();
|
Loader.Configure(_blurg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IContextExtensionBase.Require(IContextBase context) => Require((Application)context);
|
void IContextExtensionBase.Require(IContextBase context) => Require((Application)context);
|
||||||
|
|
||||||
private void RequireDeviceContextExtension(DeviceContext dc)
|
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)
|
private void OnDeviceContextCreated(object? sender, DeviceContext dc)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BlurgText" Version="0.1.0-nightly-33" />
|
<PackageReference Include="BlurgText" Version="0.1.0" />
|
||||||
<ProjectReference Include="..\Dashboard.Common\Dashboard.Common.csproj" />
|
<ProjectReference Include="..\Dashboard.Common\Dashboard.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Dashboard.OpenGL.Drawing
|
|||||||
{
|
{
|
||||||
if (_vao == -1)
|
if (_vao == -1)
|
||||||
{
|
{
|
||||||
GL.CreateVertexArray(out _vao);
|
GL.GenVertexArray(out _vao);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -462,7 +462,6 @@ namespace Dashboard.OpenGL.Drawing
|
|||||||
call.SetStencilMode();
|
call.SetStencilMode();
|
||||||
call.SetPrimitiveRestart();
|
call.SetPrimitiveRestart();
|
||||||
call.SetColorMask();
|
call.SetColorMask();
|
||||||
call.SetDepthMode();
|
|
||||||
call.SetPointSize();
|
call.SetPointSize();
|
||||||
call.SetLineWidth();
|
call.SetLineWidth();
|
||||||
call.UseTextures();
|
call.UseTextures();
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ namespace Dashboard.OpenGL
|
|||||||
public BufferAccessPattern AccessPattern { get; } = pattern;
|
public BufferAccessPattern AccessPattern { get; } = pattern;
|
||||||
public long Size { get; private set; } = size;
|
public long Size { get; private set; } = size;
|
||||||
public long Offset { get; private set; } = offset;
|
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)
|
public void Reallocate(long newSize)
|
||||||
{
|
{
|
||||||
GL.CreateBuffer(out int handle);
|
GL.GenBuffer(out int handle);
|
||||||
GL.BindBuffer(BufferTarget.ArrayBuffer, handle);
|
GL.BindBuffer(BufferTarget.ArrayBuffer, handle);
|
||||||
GL.BufferData(BufferTarget.ArrayBuffer, (nint)newSize, (nint)0, AccessPattern switch
|
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.BlurgText.OpenGL;
|
||||||
using Dashboard.Controls;
|
using Dashboard.Controls;
|
||||||
using Dashboard.Drawing;
|
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,
|
MessageBox box = MessageBox.Create(window, "Are you sure you want to exit?", "Confirm Exit", MessageBoxIcon.Question,
|
||||||
MessageBoxButtons.YesNo);
|
MessageBoxButtons.YesNo);
|
||||||
|
|
||||||
// window.Title = "DashTerm";
|
window.Title = "DashTerm";
|
||||||
TK.Window.SetMinClientSize(window.WindowHandle, 300, 200);
|
TK.Window.SetMinClientSize(window.WindowHandle, 300, 200);
|
||||||
TK.Window.SetClientSize(window.WindowHandle, new Vector2i(320, 240));
|
TK.Window.SetClientSize(window.WindowHandle, new Vector2i(320, 240));
|
||||||
TK.Window.SetBorderStyle(window.WindowHandle, WindowBorderStyle.ResizableBorder);
|
TK.Window.SetBorderStyle(window.WindowHandle, WindowBorderStyle.ResizableBorder);
|
||||||
@@ -106,7 +107,7 @@ IShader shader = direct.CreatePipeline(new GlslShaderCreateInfo()
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
fcolor = vcolor;
|
fcolor = vcolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
""",
|
""",
|
||||||
@@ -133,10 +134,15 @@ window.EventRaised += (sender, eventArgs) =>
|
|||||||
app.Run(true, source.Token);
|
app.Run(true, source.Token);
|
||||||
|
|
||||||
|
|
||||||
class BlurgTextExtensionFactory : IBlurgDcExtensionFactory
|
class BlurgTextExtensionFactory : IBlurgTextLoader
|
||||||
{
|
{
|
||||||
public BlurgDcExtension CreateExtension(BlurgTextExtension appExtension, DeviceContext dc)
|
public BlurgDcExtension CreateExtension(BlurgTextExtension appExtension, DeviceContext dc)
|
||||||
{
|
{
|
||||||
return new BlurgGLExtension();
|
return new BlurgGLExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Configure(Blurg blurg)
|
||||||
|
{
|
||||||
|
blurg.EnableSystemFonts();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user