I have a very basic question, I want to create a text like a title that is more eye-catching than normal ImGui::Text, with a larger font and different colors.
I checked the documentation and this can be achieved with different fonts.
Load multiple fonts:
// Init
ImGuiIO& io = ImGui::GetIO();
ImFont* font1 = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
ImFont* font2 = io.Fonts->AddFontFromFileTTF("anotherfont.otf", size_pixels);
// In application loop: select font at runtime
ImGui::Text("Hello"); // use the default font (which is the first loaded font)
ImGui::PushFont(font2);
ImGui::Text("Hello with another font");
ImGui::PopFont();
As I was on an open source project to make some modifications, The project is structured like this
├─Project
│ │ GUI.cpp
│ │ GUI.hpp
│ │ Hooks.cpp
│ │ Hooks.hpp
In GUI.cpp
ImGui::Begin();
//Title ImGui Text Here
ImGui::PushFont(font_title);
ImGui::Text("Title");
ImGui::PopFont();
//Normal ImGui Text Here
ImGui::Text("Normal");
ImGui::End();
Now my question is where should I add my title font and how do I use it in GUI.cpp.
Sorry, this seems like a very rookie question, but I have checked all the documentation I can read, and since this is a small open source project and not all code in one file, So I don't quite understand how to do.
I don't see how this can be an issue of ImThemes.
Ask in stackoverflow or imgui's repo discussions section if you want help about imgui.
Also ImThemes is written in Nim, I don't use C++ directly.
I have a very basic question, I want to create a text like a title that is more eye-catching than normal
ImGui::Text
, with a larger font and different colors.I checked the documentation and this can be achieved with different fonts.
Load multiple fonts:
As I was on an open source project to make some modifications, The project is structured like this ├─Project │ │ GUI.cpp │ │ GUI.hpp │ │ Hooks.cpp │ │ Hooks.hpp
In GUI.cpp
In Hook.cpp
Now my question is where should I add my title font and how do I use it in GUI.cpp.
Sorry, this seems like a very rookie question, but I have checked all the documentation I can read, and since this is a small open source project and not all code in one file, So I don't quite understand how to do.