Тьомчик
-
Автор темы
- #1
draw_text:
void imguirender::draw_text(const std::string& text, ImFont* font, ImVec2 pos, float size, color outline, color clr, bool text_center_align, bool text_right_align, bool text_outline, bool text_dropshadow)
{
_drawList = ImGui::GetBackgroundDrawList();
_drawList->PushTextureID(font->ContainerAtlas->TexID);
ImVec2 textSize = ImGui::CalcTextSize(text.c_str());
if (!text_right_align && text_center_align)
{
pos.x -= textSize.x / 2.0f;
}
if (!text_center_align && text_right_align)
{
pos.x -= textSize.x;
}
if (!text_outline && text_dropshadow)
{
_drawList->AddText(font, size, ImVec2(pos.x + 1, pos.y + 1), getU32(color(outline[0], outline[1], outline[2], clr.get_alpha())), text.c_str());
}
if (!text_dropshadow && text_outline)
{
_drawList->AddText(font, size, ImVec2(pos.x + 1, pos.y + 1), getU32(color(outline[0], outline[1], outline[2], clr.get_alpha())), text.c_str());
_drawList->AddText(font, size, ImVec2(pos.x - 1, pos.y - 1), getU32(color(outline[0], outline[1], outline[2], clr.get_alpha())), text.c_str());
_drawList->AddText(font, size, ImVec2(pos.x + 1, pos.y - 1), getU32(color(outline[0], outline[1], outline[2], clr.get_alpha())), text.c_str());
_drawList->AddText(font, size, ImVec2(pos.x - 1, pos.y + 1), getU32(color(outline[0], outline[1], outline[2], clr.get_alpha())), text.c_str());
}
_drawList->AddText(font, size, pos, getU32(clr), text.c_str());
_drawList->PopTextureID();
}
Для вызова есп использую paint_traverse хук и present
Последнее редактирование: