This commit is contained in:
4sval
2023-02-13 01:05:54 +01:00
parent c7d532fff9
commit 9b4c83931b
10 changed files with 170 additions and 66 deletions

View File

@@ -33,9 +33,9 @@ public class ImGuiController : IDisposable
private int _windowHeight;
// private string _iniPath;
private ImFontPtr _normal;
private ImFontPtr _bold;
private ImFontPtr _semiBold;
public ImFontPtr FontNormal;
public ImFontPtr FontBold;
public ImFontPtr FontSemiBold;
private readonly Vector2 _scaleFactor = Vector2.One;
@@ -57,9 +57,9 @@ public class ImGuiController : IDisposable
// ImGui.LoadIniSettingsFromDisk(_iniPath);
var io = ImGui.GetIO();
_normal = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeui.ttf", 16);
_bold = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeuib.ttf", 16);
_semiBold = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\seguisb.ttf", 16);
FontNormal = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeui.ttf", 16);
FontBold = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeuib.ttf", 16);
FontSemiBold = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\seguisb.ttf", 16);
io.BackendFlags |= ImGuiBackendFlags.RendererHasVtxOffset;
io.ConfigFlags |= ImGuiConfigFlags.NavEnableKeyboard;
@@ -75,13 +75,13 @@ public class ImGuiController : IDisposable
_frameBegun = true;
}
public void Bold() => PushFont(_bold);
public void SemiBold() => PushFont(_semiBold);
public void Bold() => PushFont(FontBold);
public void SemiBold() => PushFont(FontSemiBold);
public void PopFont()
{
ImGui.PopFont();
PushFont(_normal);
PushFont(FontNormal);
}
private void PushFont(ImFontPtr ptr) => ImGui.PushFont(ptr);