Merge branch 'feature/interface-scaling' into 'main'
Resize font and add JetBrainsMono See merge request jack/terravisor!3
This commit is contained in:
commit
9e6d0d4c02
16
imgui.ini
16
imgui.ini
|
@ -19,7 +19,7 @@ Collapsed=0
|
|||
|
||||
[Window][TerraVisor]
|
||||
Pos=0,0
|
||||
Size=1676,1017
|
||||
Size=2880,1676
|
||||
Collapsed=0
|
||||
|
||||
[Window][Scene Window]
|
||||
|
@ -29,21 +29,21 @@ Collapsed=0
|
|||
DockId=0x00000003,0
|
||||
|
||||
[Window][Viewport]
|
||||
Pos=0,19
|
||||
Size=1224,998
|
||||
Pos=0,34
|
||||
Size=2134,1641
|
||||
Collapsed=0
|
||||
DockId=0x00000003,0
|
||||
|
||||
[Window][Scene Settings]
|
||||
Pos=1226,19
|
||||
Size=450,998
|
||||
Pos=2137,34
|
||||
Size=743,1641
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
[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=0x00000003 Parent=0x00000001 SizeRef=2107,701 CentralNode=1 Selected=0x13926F0B
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=450,701 Selected=0x413E6147
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=2134,701 CentralNode=1 Selected=0x13926F0B
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=743,701 Selected=0x413E6147
|
||||
DockNode ID=0x00000002 Parent=0x6F42A598 SizeRef=419,701 Selected=0xF69494A7
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,7 @@
|
|||
#ifndef INTERFACE_H_
|
||||
#define INTERFACE_H_
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <imgui.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -19,6 +20,7 @@ struct Window {
|
|||
};
|
||||
|
||||
namespace Interface {
|
||||
void ApplyUIScaling(GLFWwindow* window);
|
||||
void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc);
|
||||
Window* GetWindowByName(std::vector<Window>& windows, const std::string& name);
|
||||
void RenderWindows(std::vector<Window>& windows);
|
||||
|
|
|
@ -4,9 +4,32 @@
|
|||
#include <imgui_impl_opengl3.h>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
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();
|
||||
std::cout << "Current Path: " << std::filesystem::current_path() << std::endl;
|
||||
|
||||
#ifdef _WIN32
|
||||
io.Fonts->AddFontFromFileTTF("imgui/misc/fonts/JetBrainsMono/JetBrainsMono-Medium.ttf", 8.0f * scale);
|
||||
#else
|
||||
io.Fonts->AddFontFromFileTTF("../imgui/misc/fonts/JetBrainsMono/JetBrainsMono-Medium.ttf", 8.0f * scale);
|
||||
#endif
|
||||
io.Fonts->Build();
|
||||
}
|
||||
|
||||
void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc) {
|
||||
windows.emplace_back(name, renderFunc);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "config.h"
|
||||
#include "callbacks.h"
|
||||
#include "scene.h"
|
||||
#include "interface.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -156,6 +157,7 @@ int main() {
|
|||
scene.Init();
|
||||
InitializeImGui(window);
|
||||
FreeImage_Initialise();
|
||||
Interface::ApplyUIScaling(window);
|
||||
|
||||
// Check if we're in test mode
|
||||
const char* testEnv = std::getenv("TEST_MODE");
|
||||
|
|
Loading…
Reference in New Issue