C++ Исходник Imgui glitch effect text

Тьомчик
Участник
Статус
Оффлайн
Регистрация
30 Июн 2020
Сообщения
751
Реакции[?]
153
Поинты[?]
61K
GLITCH EFFECT TEXT:
void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect)
{
    if ((col & IM_COL32_A_MASK) == 0)
        return;

    if (text_end == NULL)
        text_end = text_begin + strlen(text_begin);
    if (text_begin == text_end)
        return;

    // Pull default font/size from the shared ImDrawListSharedData instance
    if (font == NULL)
        font = _Data->Font;
    if (font_size == 0.0f)
        font_size = _Data->FontSize;

    IM_ASSERT(font->ContainerAtlas->TexID == _CmdHeader.TextureId);  // Use high-level ImGui::PushFont() or low-level ImDrawList::PushTextureId() to change font.

    ImVec4 clip_rect = _CmdHeader.ClipRect;
    if (cpu_fine_clip_rect)
    {
        clip_rect.x = ImMax(clip_rect.x, cpu_fine_clip_rect->x);
        clip_rect.y = ImMax(clip_rect.y, cpu_fine_clip_rect->y);
        clip_rect.z = ImMin(clip_rect.z, cpu_fine_clip_rect->z);
        clip_rect.w = ImMin(clip_rect.w, cpu_fine_clip_rect->w);
    }

    float time_for_animate_color = ImGui::GetTime() /* * glitch_intensity */;

    float offset_x = sinf(time_for_animate_color) /* * glitch_rotate */;
    float offset_y = cosf(time_for_animate_color) /* * glitch_rotate */;

    ImVec4 lerp_color = ImColor(128, 0, 0, 255).Value;
    ImVec4 final_color = ImColor(0, 255, 255, 255).Value;

    ImColor main_color = ImLerp(lerp_color, final_color, sinf(time_for_animate_color));
    ImColor secondary_color = ImLerp(final_color, lerp_color, sinf(time_for_animate_color));

    font->RenderText(this, font_size, ImVec2(pos.x - (1 + (rand() % 2)) - offset_x, pos.y - (rand() % 2) - offset_y), main_color, clip_rect, text_begin, text_end, wrap_width, cpu_fine_clip_rect != NULL);
    font->RenderText(this, font_size, ImVec2(pos.x + (1 + (rand() % 2)) + offset_x, pos.y + (rand() % 2) + offset_y), secondary_color, clip_rect, text_begin, text_end, wrap_width, cpu_fine_clip_rect != NULL);
    font->RenderText(this, font_size, pos, col, clip_rect, text_begin, text_end, wrap_width, cpu_fine_clip_rect != NULL);
}
s/o unknowncheats
 
Похожие темы
Сверху Снизу