diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2021-08-08 22:57:26 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2021-08-08 22:57:26 -0400 |
commit | 1c5a7e71cecb86a9682f825f6c20ecaeb445f32c (patch) | |
tree | 6199a62666aacd8251af2e1148ada9750338ea87 | |
parent | 3da3e76f17912e1105c090b738edc1cf2a8ad861 (diff) |
add mono font, swap sans to lighter
-rw-r--r-- | fonts/Roboto-Regular.ttf | bin | 0 -> 168260 bytes | |||
-rw-r--r-- | fonts/RobotoMono-Regular.ttf | bin | 0 -> 86908 bytes | |||
-rw-r--r-- | source/gui.cpp | 6 | ||||
-rw-r--r-- | source/main.cpp | 11 |
4 files changed, 11 insertions, 6 deletions
diff --git a/fonts/Roboto-Regular.ttf b/fonts/Roboto-Regular.ttf Binary files differnew file mode 100644 index 0000000..3d6861b --- /dev/null +++ b/fonts/Roboto-Regular.ttf diff --git a/fonts/RobotoMono-Regular.ttf b/fonts/RobotoMono-Regular.ttf Binary files differnew file mode 100644 index 0000000..7c4ce36 --- /dev/null +++ b/fonts/RobotoMono-Regular.ttf diff --git a/source/gui.cpp b/source/gui.cpp index 15beb90..fad451e 100644 --- a/source/gui.cpp +++ b/source/gui.cpp @@ -18,7 +18,8 @@ #include <SDL2/SDL.h> #include <SDL2/SDL_opengl.h> -ImFont *font = nullptr; +ImFont *fontSans = nullptr; +ImFont *fontMono = nullptr; static ImGuiIO *io = nullptr; static SDL_Window *window = nullptr; static decltype(SDL_GL_CreateContext(nullptr)) gl_context; @@ -49,7 +50,8 @@ bool guiInitialize() ImGui::CreateContext(); io = &ImGui::GetIO(); io->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; - font = io->Fonts->AddFontFromFileTTF("fonts/Roboto-Medium.ttf", 20); + fontSans = io->Fonts->AddFontFromFileTTF("fonts/Roboto-Regular.ttf", 20); + fontMono = io->Fonts->AddFontFromFileTTF("fonts/RobotoMono-Regular.ttf", 20); ImGui::StyleColorsLight(); ImGui_ImplSDL2_InitForOpenGL(window, gl_context); diff --git a/source/main.cpp b/source/main.cpp index dc5f789..8c87081 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -20,7 +20,8 @@ #include <string> // Externs -extern ImFont *font; +extern ImFont *fontSans; +extern ImFont *fontMono; extern bool guiInitialize(); extern void guiHandleEvents(bool& done); @@ -79,20 +80,22 @@ int main(int, char **) ImGui::SetNextWindowSize({WINDOW_WIDTH, WINDOW_HEIGHT - 22 - 200}); ImGui::Begin("main", nullptr, ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoDecoration); - ImGui::PushFont(font); // Render main controls (order is important). + ImGui::PushFont(fontSans); codeRenderToolbar(); deviceRenderToolbar(); fileRenderDialog(); - codeRenderWidgets(); + ImGui::PopFont(); + ImGui::PushFont(fontMono); + codeRenderWidgets(); ImGui::SetNextWindowPos({0, WINDOW_HEIGHT - 200}); ImGui::SetNextWindowSize({WINDOW_WIDTH, 200}); logView.Draw("log", nullptr, ImGuiWindowFlags_NoDecoration); + ImGui::PopFont(); // Finish main view rendering. - ImGui::PopFont(); ImGui::End(); // Draw everything to the screen. |