Implemented embedded version information (#82)

This commit is contained in:
Hyper
2025-01-17 12:13:37 +00:00
committed by GitHub
parent 92cfee2a97
commit 15c962150b
10 changed files with 210 additions and 5 deletions
+12
View File
@@ -3,6 +3,7 @@
#include <gpu/imgui/imgui_common.h>
#include <gpu/video.h>
#include <app.h>
#include <version.h>
#define PIXELS_TO_UV_COORDS(textureWidth, textureHeight, x, y, width, height) \
std::make_tuple(ImVec2((float)x / (float)textureWidth, (float)y / (float)textureHeight), \
@@ -437,3 +438,14 @@ inline ImU32 ColourLerp(ImU32 c0, ImU32 c1, float t)
return ImGui::ColorConvertFloat4ToU32(result);
}
inline void DrawVersionString(const ImFont* font, const ImU32 col = IM_COL32(255, 255, 255, 70))
{
auto drawList = ImGui::GetForegroundDrawList();
auto& res = ImGui::GetIO().DisplaySize;
auto fontSize = Scale(12);
auto textMargin = Scale(2);
auto textSize = font->CalcTextSizeA(fontSize, FLT_MAX, 0, g_versionString);
drawList->AddText(font, fontSize, { res.x - textSize.x - textMargin, res.y - textSize.y - textMargin }, col, g_versionString);
}
+3 -2
View File
@@ -574,8 +574,8 @@ static void DrawScanlineBars()
// Installer text
const std::string &headerText = Localise(g_currentPage == WizardPage::Installing ? "Installer_Header_Installing" : "Installer_Header_Installer");
int textAlpha = std::lround(255.0f * ComputeMotionInstaller(g_appearTime, g_disappearTime, TITLE_ANIMATION_TIME, TITLE_ANIMATION_DURATION));
DrawTextWithOutline(g_dfsogeistdFont, Scale(42.0f), { Scale(285.0f), Scale(57.0f) }, IM_COL32(255, 195, 0, textAlpha), headerText.c_str(), 4, IM_COL32(0, 0, 0, textAlpha), IMGUI_SHADER_MODIFIER_TITLE_BEVEL);
auto alphaMotion = ComputeMotionInstaller(g_appearTime, g_disappearTime, TITLE_ANIMATION_TIME, TITLE_ANIMATION_DURATION);
DrawTextWithOutline(g_dfsogeistdFont, Scale(42.0f), { Scale(285.0f), Scale(57.0f) }, IM_COL32(255, 195, 0, 255 * alphaMotion), headerText.c_str(), 4, IM_COL32(0, 0, 0, 255 * alphaMotion), IMGUI_SHADER_MODIFIER_TITLE_BEVEL);
// Top bar line
drawList->AddLine
@@ -596,6 +596,7 @@ static void DrawScanlineBars()
);
DrawHeaderIcons();
DrawVersionString(g_newRodinFont, IM_COL32(255, 255, 255, 70 * alphaMotion));
}
static float AlignToNextGrid(float value)
+2
View File
@@ -180,6 +180,8 @@ static void DrawScanlineBars()
OUTLINE_COLOR,
Scale(1)
);
DrawVersionString(g_newRodinFont);
}
static float AlignToNextGrid(float value)