using FontStashSharp; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Veldrid.Common { internal class GraphicsManger:IDisposable { private bool disposedValue; public GraphicsDevice Device { get; } public ShaderManger ShaderManger { get; } public GraphicsManger(GraphicsDevice device) { Device = device; CommandList = Device.ResourceFactory.CreateCommandList(); GLSLManger.Default.Init(); ShaderManger = new ShaderManger(Device); FontManger.Instance.AddFontDirectory(Environment.CurrentDirectory+"\\Fonts"); } public CommandList CommandList { get; } protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { Device?.Dispose(); CommandList?.Dispose(); ShaderManger?.Dispose(); // TODO: 释放托 // 管状态(托管对象) } // TODO: 释放未托管的资源(未托管的对象)并重写终结器 // TODO: 将大型字段设置为 null disposedValue = true; } } // // TODO: 仅当“Dispose(bool disposing)”拥有用于释放未托管资源的代码时才替代终结器 // ~GraphicsManger() // { // // 不要更改此代码。请将清理代码放入“Dispose(bool disposing)”方法中 // Dispose(disposing: false); // } public void Dispose() { // 不要更改此代码。请将清理代码放入“Dispose(bool disposing)”方法中 Dispose(disposing: true); GC.SuppressFinalize(this); } } }