diff --git a/res/icon.png b/res/icon.png index b7a0614b9b..05e11c9b41 100644 Binary files a/res/icon.png and b/res/icon.png differ diff --git a/res/logo.png b/res/logo.png new file mode 100644 index 0000000000..34f1d59cd0 Binary files /dev/null and b/res/logo.png differ diff --git a/res/org-icon.png b/res/org-icon.png new file mode 100644 index 0000000000..b7a0614b9b Binary files /dev/null and b/res/org-icon.png differ diff --git a/src/dusk/imgui/ImGuiEngine.cpp b/src/dusk/imgui/ImGuiEngine.cpp index f8dc048c0f..00701af02b 100644 --- a/src/dusk/imgui/ImGuiEngine.cpp +++ b/src/dusk/imgui/ImGuiEngine.cpp @@ -29,13 +29,22 @@ bool AssetExists(const std::string& path) { SDL_PathInfo pathInfo{}; return SDL_GetPathInfo(path.c_str(), &pathInfo) && pathInfo.type == SDL_PATHTYPE_FILE; } + +ImTextureID AddTexture(const char* assetName) { + auto image = GetImage(GetAssetPath(assetName)); + if (image.data == nullptr || image.width == 0 || image.height == 0) { + return 0; + } + return aurora_imgui_add_texture(image.width, image.height, image.data.get()); +} } // namespace ImFont* ImGuiEngine::fontNormal; ImFont* ImGuiEngine::fontLarge; ImFont* ImGuiEngine::fontExtraLarge; ImFont* ImGuiEngine::fontMono; -ImTextureID ImGuiEngine::duskIcon = 0; +ImTextureID ImGuiEngine::orgIcon = 0; +ImTextureID ImGuiEngine::duskLogo = 0; inline ImFont* CreateFont(float size, const std::string& fontPath, std::string_view fontName) { bool fontFileExists = !fontPath.empty() && AssetExists(fontPath); @@ -187,13 +196,11 @@ Image GetImage(const std::string& path) { } void ImGuiEngine_AddTextures() { - if (ImGuiEngine::duskIcon == 0) { - auto icon = GetImage(GetAssetPath("icon.png")); - if (icon.data == nullptr || icon.width == 0 || icon.height == 0) { - ImGuiEngine::duskIcon = 0; - return; - } - ImGuiEngine::duskIcon = aurora_imgui_add_texture(icon.width, icon.height, icon.data.get()); + if (ImGuiEngine::orgIcon == 0) { + ImGuiEngine::orgIcon = AddTexture("org-icon.png"); + } + if (ImGuiEngine::duskLogo == 0) { + ImGuiEngine::duskLogo = AddTexture("logo.png"); } } } // namespace dusk diff --git a/src/dusk/imgui/ImGuiEngine.hpp b/src/dusk/imgui/ImGuiEngine.hpp index 4b0baaa3a8..3b3e3e0303 100644 --- a/src/dusk/imgui/ImGuiEngine.hpp +++ b/src/dusk/imgui/ImGuiEngine.hpp @@ -11,7 +11,8 @@ public: static ImFont* fontLarge; static ImFont* fontExtraLarge; static ImFont* fontMono; - static ImTextureID duskIcon; + static ImTextureID orgIcon; + static ImTextureID duskLogo; }; void ImGuiEngine_Initialize(float scale); @@ -23,5 +24,5 @@ struct Image { uint32_t width; uint32_t height; }; -Image GetImage(std::string_view path); +Image GetImage(const std::string& path); } // namespace dusk diff --git a/src/dusk/imgui/ImGuiPreLaunchWindow.cpp b/src/dusk/imgui/ImGuiPreLaunchWindow.cpp index 15b229a3cb..adb5952a85 100644 --- a/src/dusk/imgui/ImGuiPreLaunchWindow.cpp +++ b/src/dusk/imgui/ImGuiPreLaunchWindow.cpp @@ -80,12 +80,20 @@ void ImGuiPreLaunchWindow::draw() { float iconSize = 150.f; ImGui::SameLine(windowSize.x / 2 - iconSize + (iconSize / 2)); - if (ImGuiEngine::duskIcon != 0) - ImGui::Image(ImGuiEngine::duskIcon, ImVec2{iconSize, iconSize}); + if (ImGuiEngine::orgIcon != 0) { + ImGui::Image(ImGuiEngine::orgIcon, ImVec2{iconSize, iconSize}); + } ImGuiTextCenter("Twilit Realm presents"); - ImGui::PushFont(ImGuiEngine::fontExtraLarge); - ImGuiTextCenter("Dusk"); - ImGui::PopFont(); + if (ImGuiEngine::duskLogo) { + ImGui::NewLine(); + float width = iconSize * 2.5f; + ImGui::SameLine(windowSize.x / 2 - width + (width / 2)); + ImGui::Image(ImGuiEngine::duskLogo, ImVec2{width, iconSize}); + } else { + ImGui::PushFont(ImGuiEngine::fontExtraLarge); + ImGuiTextCenter("Dusk"); + ImGui::PopFont(); + } (this->*drawTable[m_CurMenu])();