From 2d7e772909571676dd4266337d43086bd2927e93 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 29 Mar 2021 00:06:34 -0700 Subject: UI big structure --- core/src/Entrypoint/main.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'core/src/Entrypoint') 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 #include @@ -123,19 +127,25 @@ int main(int argc, char* argv[]) { auto backendOption = parser.get("--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(); }); + // 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(); } -- cgit v1.2.3-70-g09d2