Resize font and add JetBrainsMono

This commit is contained in:
Jack 2024-08-28 21:07:15 -04:00
parent da8487d7dd
commit 9c00945ea1
36 changed files with 31 additions and 8 deletions

View File

@ -19,7 +19,7 @@ Collapsed=0
[Window][TerraVisor] [Window][TerraVisor]
Pos=0,0 Pos=0,0
Size=1676,1017 Size=2880,1676
Collapsed=0 Collapsed=0
[Window][Scene Window] [Window][Scene Window]
@ -29,21 +29,21 @@ Collapsed=0
DockId=0x00000003,0 DockId=0x00000003,0
[Window][Viewport] [Window][Viewport]
Pos=0,19 Pos=0,34
Size=1224,998 Size=2134,1641
Collapsed=0 Collapsed=0
DockId=0x00000003,0 DockId=0x00000003,0
[Window][Scene Settings] [Window][Scene Settings]
Pos=1226,19 Pos=2137,34
Size=450,998 Size=743,1641
Collapsed=0 Collapsed=0
DockId=0x00000004,0 DockId=0x00000004,0
[Docking][Data] [Docking][Data]
DockSpace ID=0x6F42A598 Window=0xE80F322C Pos=0,19 Size=1676,998 Split=X Selected=0x9F2D9299 DockSpace ID=0x6F42A598 Window=0xE80F322C Pos=0,34 Size=2880,1641 Split=X Selected=0x9F2D9299
DockNode ID=0x00000001 Parent=0x6F42A598 SizeRef=0,0 Split=X Selected=0x13926F0B DockNode ID=0x00000001 Parent=0x6F42A598 SizeRef=0,0 Split=X Selected=0x13926F0B
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=2107,701 CentralNode=1 Selected=0x13926F0B DockNode ID=0x00000003 Parent=0x00000001 SizeRef=2134,701 CentralNode=1 Selected=0x13926F0B
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=450,701 Selected=0x413E6147 DockNode ID=0x00000004 Parent=0x00000001 SizeRef=743,701 Selected=0x413E6147
DockNode ID=0x00000002 Parent=0x6F42A598 SizeRef=419,701 Selected=0xF69494A7 DockNode ID=0x00000002 Parent=0x6F42A598 SizeRef=419,701 Selected=0xF69494A7

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,7 @@
#ifndef INTERFACE_H_ #ifndef INTERFACE_H_
#define INTERFACE_H_ #define INTERFACE_H_
#include <GLFW/glfw3.h>
#include <imgui.h> #include <imgui.h>
#include <string> #include <string>
#include <vector> #include <vector>
@ -19,6 +20,7 @@ struct Window {
}; };
namespace Interface { namespace Interface {
void ApplyUIScaling(GLFWwindow* window);
void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc); void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc);
Window* GetWindowByName(std::vector<Window>& windows, const std::string& name); Window* GetWindowByName(std::vector<Window>& windows, const std::string& name);
void RenderWindows(std::vector<Window>& windows); void RenderWindows(std::vector<Window>& windows);

View File

@ -4,9 +4,28 @@
#include <imgui_impl_opengl3.h> #include <imgui_impl_opengl3.h>
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <filesystem>
namespace Interface { namespace Interface {
void ApplyUIScaling(GLFWwindow* window) {
float xScale, yScale;
glfwGetWindowContentScale(window, &xScale, &yScale);
float scale = (xScale + yScale) * 0.5f;
ImGui::GetIO().FontGlobalScale = scale;
ImGuiStyle& style = ImGui::GetStyle();
style.ScaleAllSizes(scale);
ImGuiIO& io = ImGui::GetIO();
io.Fonts->Clear();
io.Fonts->AddFontFromFileTTF("imgui/misc/fonts/JetBrainsMono/JetBrainsMono-Medium.ttf", 8.0f * scale);
io.Fonts->Build();
}
void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc) { void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc) {
windows.emplace_back(name, renderFunc); windows.emplace_back(name, renderFunc);
} }

View File

@ -42,6 +42,7 @@
#include "config.h" #include "config.h"
#include "callbacks.h" #include "callbacks.h"
#include "scene.h" #include "scene.h"
#include "interface.h"
namespace { namespace {
@ -156,6 +157,7 @@ int main() {
scene.Init(); scene.Init();
InitializeImGui(window); InitializeImGui(window);
FreeImage_Initialise(); FreeImage_Initialise();
Interface::ApplyUIScaling(window);
// Check if we're in test mode // Check if we're in test mode
const char* testEnv = std::getenv("TEST_MODE"); const char* testEnv = std::getenv("TEST_MODE");