Add Dusk logo to imgui prelaunch

This commit is contained in:
Luke Street
2026-04-13 19:25:50 -06:00
parent 50a8ebab28
commit 7136c90336
6 changed files with 31 additions and 15 deletions
+15 -8
View File
@@ -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