Settings / SettingsWindow

This commit is contained in:
Simon Lübeß
2022-04-10 13:12:09 +02:00
parent bca72cf0d4
commit bec202e23a
12 changed files with 438 additions and 6 deletions
+28 -1
View File
@@ -2,13 +2,14 @@ using System;
using ImGui;
using GlitchyEngine.Events;
using ImGuizmo;
using GlitchyEngine.Renderer;
using System.IO;
using internal ImGui;
#if GE_GRAPHICS_DX11
using GlitchyEngine.Platform.DX11;
using GlitchyEngine.Renderer;
using internal GlitchyEngine.Platform.DX11;
#endif
@@ -19,6 +20,8 @@ namespace GlitchyEngine.ImGui
{
ImGui.IO* _io;
public bool SettingsInvalid;
public this() : base("ImGuiLayer") { }
public override void OnAttach()
@@ -87,6 +90,30 @@ namespace GlitchyEngine.ImGui
{
Debug.Profiler.ProfileFunction!();
if (SettingsInvalid)
{
var settings = Application.Get().Settings.ImGuiSettings;
ImGui.GetIO().Fonts.Clear();
String fullpath = scope String();
Application.Get().ContentManager.GetFilePath(fullpath, settings.FontName);
if (File.Exists(fullpath))
{
ImGui.GetIO().Fonts.AddFontFromFileTTF(fullpath, settings.FontSize);
}
else
{
ImGui.GetIO().Fonts.AddFontDefault();
}
#if GE_GRAPHICS_DX11
ImGuiImplDX11.CreateDeviceObjects();
#endif
SettingsInvalid = false;
}
Begin();
{