diff options
Diffstat (limited to 'core/src/Entrypoint/main.cpp')
-rw-r--r-- | core/src/Entrypoint/main.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/core/src/Entrypoint/main.cpp b/core/src/Entrypoint/main.cpp index a8c988a..9f57a5e 100644 --- a/core/src/Entrypoint/main.cpp +++ b/core/src/Entrypoint/main.cpp @@ -5,6 +5,10 @@ #include "Entrypoint/OpenGL2.hpp" #include "Entrypoint/OpenGL3.hpp" #include "Entrypoint/Vulkan.hpp" +#include "UI/Localization.hpp" +#include "UI/UI.hpp" +#include "Utils/I18n.hpp" +#include "Utils/Sigslot.hpp" #include <glad/glad.h> #include <GLFW/glfw3.h> @@ -123,19 +127,25 @@ int main(int argc, char* argv[]) { auto backendOption = parser.get<std::string>("--rendering-backend"); auto backend = CreateBackend(backendOption); - auto& io = ImGui::GetIO(); + ImGui::StyleColorsLight(); + // Includes latin alphabet, although for some reason smaller than if rendered using 18 point NotoSans regular - io.Fonts->AddFontFromFileTTF("fonts/NotoSansSC-Regular.otf", 18, nullptr, io.Fonts->GetGlyphRangesChineseSimplifiedCommon()); + ImGui::GetIO().Fonts->AddFontFromFileTTF("fonts/NotoSansSC-Regular.otf", 18, nullptr, ImGui::GetIO().Fonts->GetGlyphRangesChineseSimplifiedCommon()); - ImWchar kIconRanges[] = { ICON_MIN_FA, ICON_MAX_FA }; + ImWchar iconRanges[] = { ICON_MIN_FA, ICON_MAX_FA }; ImFontConfig config; config.MergeMode = true; - io.Fonts->AddFontFromFileTTF("fonts/FontAwesome5-Solid.otf", 14, &config, kIconRanges); + ImGui::GetIO().Fonts->AddFontFromFileTTF("fonts/FontAwesome5-Solid.otf", 14, &config, iconRanges); + + I18n::reloadSignal.Connect([]() { LocaleStrings::Instance = std::make_unique<LocaleStrings>(); }); + // Do i18n intialization after linking reload signals, so that when SetLanguage() is called, the locale strings will be initialized (without us writing the code another time outside the slot) + I18n::Init(); + I18n::SetLanguage("zh_CN"); auto window = backend->GetWindow(); while (!glfwWindowShouldClose(window)) { backend->BeginFrame(); - ImGui::ShowDemoWindow(); + UI::MainWindow(); backend->EndFrame(); } |