add config file

This commit is contained in:
bird_egop
2026-06-07 00:41:16 +03:00
parent 4e45bd236c
commit 8bed73fb5a
10 changed files with 169 additions and 35 deletions
+20
View File
@@ -26,6 +26,7 @@ public class App
public ImFontPtr OpenSansFont;
private List<IImGuiPanel> _imGuiPanels = [];
private Later _later = new();
public App()
{
@@ -40,6 +41,9 @@ public class App
IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddSingleton<ILater>(_later);
serviceCollection.AddSingleton<IConfigProvider>(new ConfigProvider(new ConfigJson()));
foreach (var type in Utils.GetAssignableTypes<IService>())
{
serviceCollection.AddSingleton(type);
@@ -50,6 +54,11 @@ public class App
serviceCollection.AddSingleton(type);
}
foreach (var type in Utils.GetAssignableTypes<ILaunchReceiver>())
{
serviceCollection.AddSingleton(type);
}
serviceCollection.AddSingleton(openGl);
serviceCollection.AddSingleton(window);
@@ -68,6 +77,12 @@ public class App
_imGuiPanels = Utils.GetAssignableTypes<IImGuiPanel>()
.Select(t => (serviceProvider.GetService(t) as IImGuiPanel)!)
.ToList();
foreach (var type in Utils.GetAssignableTypes<ILaunchReceiver>())
{
var launchReceiver = serviceProvider.GetService(type) as ILaunchReceiver;
launchReceiver?.OnLaunch();
}
}
public void OnImGuiRender()
@@ -123,6 +138,11 @@ public class App
{
imGuiPanel.OnImGuiRender();
}
foreach (var action in _later.Enumerate())
{
action();
}
// ImGui.ShowMetricsWindow();
// ImGui.ShowDemoWindow();