Да, именнотебе нужно сделать текст над боксами есп или что?
Да, именно
[TABLE]
[TR]
[TD]float RenderText(const std::string text, const ImVec2& position, float size, ImVec4 color, bool center, ImFont* DefaultFont)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]{[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] ImDrawList* Draw = ImGui::GetWindowDrawList();[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] std::stringstream stream(text);[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] std::string line;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] float y = 0.0f;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] int i = 0;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] while (std::getline(stream, line))[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] {[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] ImVec2 textSize = DefaultFont->CalcTextSizeA(size, FLT_MAX, 0.0f, line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] if (center)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] {[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) + 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) - 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) + 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) - 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { position.x - textSize.x / 2.0f, position.y + textSize.y * i }, ImGui::GetColorU32(color), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] }[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] else[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] {[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x) + 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x) - 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x) + 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x) - 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { position.x, position.y + textSize.y * i }, ImGui::GetColorU32(color), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] }[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] y = position.y + textSize.y * (i + 1);[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] i++;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] }[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] return y;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]}[/TD]
[/TR]
[/TABLE]
сорян не так сделал
[TABLE]
[TR]
[TD]float RenderText(const std::string text, const ImVec2& position, float size, ImVec4 color, bool center, ImFont* DefaultFont)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]{[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] ImDrawList* Draw = ImGui::GetWindowDrawList();[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] std::stringstream stream(text);[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] std::string line;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] float y = 0.0f;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] int i = 0;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] while (std::getline(stream, line))[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] {[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] ImVec2 textSize = DefaultFont->CalcTextSizeA(size, FLT_MAX, 0.0f, line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] if (center)[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] {[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) + 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) - 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) + 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) - 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { position.x - textSize.x / 2.0f, position.y + textSize.y * i }, ImGui::GetColorU32(color), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] }[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] else[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] {[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x) + 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x) - 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x) + 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { (position.x) - 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Draw->AddText(DefaultFont, size, { position.x, position.y + textSize.y * i }, ImGui::GetColorU32(color), line.c_str());[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] }[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] y = position.y + textSize.y * (i + 1);[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] i++;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] }[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] return y;[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]}[/TD]
[/TR]
[/TABLE]
float RenderText(const std::string text, const ImVec2& position, float size, ImVec4 color, bool center, ImFont* DefaultFont) | |
{ | |
ImDrawList* Draw = ImGui::GetWindowDrawList(); | |
std::stringstream stream(text); | |
std::string line; | |
float y = 0.0f; | |
int i = 0; | |
while (std::getline(stream, line)) | |
{ | |
ImVec2 textSize = DefaultFont->CalcTextSizeA(size, FLT_MAX, 0.0f, line.c_str()); | |
if (center) | |
{ | |
Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) + 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); | |
Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) - 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); | |
Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) + 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); | |
Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) - 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); | |
Draw->AddText(DefaultFont, size, { position.x - textSize.x / 2.0f, position.y + textSize.y * i }, ImGui::GetColorU32(color), line.c_str()); | |
} | |
else | |
{ | |
Draw->AddText(DefaultFont, size, { (position.x) + 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); | |
Draw->AddText(DefaultFont, size, { (position.x) - 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); | |
Draw->AddText(DefaultFont, size, { (position.x) + 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); | |
Draw->AddText(DefaultFont, size, { (position.x) - 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); | |
Draw->AddText(DefaultFont, size, { position.x, position.y + textSize.y * i }, ImGui::GetColorU32(color), line.c_str()); | |
} | |
y = position.y + textSize.y * (i + 1); | |
i++; | |
} | |
return y; | |
} |
Напиши свой дссорян не так сделал
float RenderText(const std::string text, const ImVec2& position, float size, ImVec4 color, bool center, ImFont* DefaultFont) { ImDrawList* Draw = ImGui::GetWindowDrawList(); std::stringstream stream(text); std::string line; float y = 0.0f; int i = 0; while (std::getline(stream, line)) { ImVec2 textSize = DefaultFont->CalcTextSizeA(size, FLT_MAX, 0.0f, line.c_str()); if (center) { Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) + 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) - 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) + 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); Draw->AddText(DefaultFont, size, { (position.x - textSize.x / 2.0f) - 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); Draw->AddText(DefaultFont, size, { position.x - textSize.x / 2.0f, position.y + textSize.y * i }, ImGui::GetColorU32(color), line.c_str()); } else { Draw->AddText(DefaultFont, size, { (position.x) + 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); Draw->AddText(DefaultFont, size, { (position.x) - 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); Draw->AddText(DefaultFont, size, { (position.x) + 1.0f, (position.y + textSize.y * i) - 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); Draw->AddText(DefaultFont, size, { (position.x) - 1.0f, (position.y + textSize.y * i) + 1.0f }, ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, color.w)), line.c_str()); Draw->AddText(DefaultFont, size, { position.x, position.y + textSize.y * i }, ImGui::GetColorU32(color), line.c_str()); } y = position.y + textSize.y * (i + 1); i++; } return y; }
мб тг?(Напиши свой дс
привет, поможешь мне создать esp+скелетон и коробкамб тг?(
дс просто не юзаю
вот тг ес чо