-
Автор темы
- #1
C++:
void RenderGlowingText(const char* text, const ImVec4& color, float glowSize, ImGuiWindow* window = nullptr) {
ImGuiContext& g = *GImGui;
ImGuiWindow* currentWindow = window ? window : g.CurrentWindow;
ImVec2 pos = ImGui::GetCursorScreenPos();
ImGui::RenderText(pos, text);
ImDrawList* drawList = currentWindow->DrawList;
ImVec2 textSize = ImGui::CalcTextSize(text);
ImVec2 drawPos = pos;
// Рендеринг обводки (глоу)
drawList->AddText(drawPos, ImGui::ColorConvertFloat4ToU32(color), text);
for (float i = 0; i < 360; i += 45) {
float dx = cosf(i) * glowSize;
float dy = sinf(i) * glowSize;
drawList->AddText(drawPos + ImVec2(dx, dy), IM_COL32_BLACK_TRANS, text);
}
}