84 const std::string& title,
const std::string& line) {
88 ImDrawList* draw = ImGui::GetForegroundDrawList();
89 const ImVec2 screen = ImGui::GetIO().DisplaySize;
90 const auto byte = [](
float value) {
91 return static_cast<int>(std::clamp(value, 0.0f, 1.0f) * 255.0f);
95 IM_COL32(
byte(sky[0]),
byte(sky[1]),
byte(sky[2]),
byte(cover)));
98 const float alpha = std::clamp(cover * 1.5f, 0.0f, 1.0f);
99 const float middle = screen.y * 0.45f;
100 const float band =
Ui(110.0f);
103 draw->AddRectFilledMultiColor({0.0f, middle - band}, {screen.x, middle},
104 clear, clear, dark, dark);
105 draw->AddRectFilledMultiColor({0.0f, middle}, {screen.x, middle + band}, dark,
108 const float title_size =
Ui(58.0f);
109 const ImVec2 title_extent =
110 title_font->CalcTextSizeA(title_size, FLT_MAX, 0.0f, title.c_str());
111 const float top = middle - title_extent.y * 0.75f;
113 {(screen.x - title_extent.x) / 2.0f, top},
116 if (alpha >= 0.99f) {
118 {screen.x / 2.0f - title_extent.x * 0.6f,
119 top + title_extent.y +
Ui(4.0f)},
120 title_extent.x * 1.2f);
123 const float line_size =
Ui(20.0f);
124 const ImVec2 line_extent =
125 text->CalcTextSizeA(line_size, FLT_MAX, 0.0f, line.c_str());
127 draw, text, line_size,
128 {(screen.x - line_extent.x) / 2.0f, top + title_extent.y +
Ui(14.0f)},
void DrawGradientText(ImDrawList *draw, ImFont *font, float size, ImVec2 at, ImU32 top, ImU32 bottom, const char *text)
void DrawShadowedText(ImDrawList *draw, ImFont *font, float size, ImVec2 at, ImU32 color, const char *text)
Text with a shadow under it.