diff options
| author | untodesu <kirill@untode.su> | 2025-12-26 14:50:33 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-12-26 14:50:33 +0500 |
| commit | 6c2abde5c99a236453b795abaa6d7d70105e31f7 (patch) | |
| tree | f085049b9615a7d03cca5de40adb6529d6c13e11 /src/game/client/gui/imutils_text.cc | |
| parent | f40d09cb8f712e87691af4912f3630d92d692779 (diff) | |
| download | voxelius-6c2abde5c99a236453b795abaa6d7d70105e31f7.tar.bz2 voxelius-6c2abde5c99a236453b795abaa6d7d70105e31f7.zip | |
Just a big Ctrl+H refactoring
Diffstat (limited to 'src/game/client/gui/imutils_text.cc')
| -rw-r--r-- | src/game/client/gui/imutils_text.cc | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/game/client/gui/imutils_text.cc b/src/game/client/gui/imutils_text.cc new file mode 100644 index 0000000..1058c7f --- /dev/null +++ b/src/game/client/gui/imutils_text.cc @@ -0,0 +1,46 @@ +#include "client/pch.hh" + +#include "client/gui/imutils_text.hh" + +#include "client/globals.hh" + +void imutils::text_nw(ImDrawList* list, std::string_view text, const ImVec2& pos, ImU32 color, ImU32 shadow, ImFont* font) +{ + assert(list); + assert(font); + + imutils::text_nw(list, text, pos, color, shadow, font, font->LegacySize); +} + +void imutils::text_nw(ImDrawList* list, std::string_view text, const ImVec2& pos, ImU32 color, ImU32 shadow, ImFont* font, float size) +{ + assert(list); + assert(font); + + auto shift = static_cast<float>(globals::gui_scale); + auto shadow_pos = ImVec2(pos.x + shift, pos.y + shift); + + list->AddText(font, size, shadow_pos, shadow, text.data(), text.data() + text.size()); + list->AddText(font, size, pos, color, text.data(), text.data() + text.size()); +} + +void imutils::text_wr(ImDrawList* list, std::string_view text, const ImVec2& pos, ImU32 color, ImU32 shadow, ImFont* font, float wrap) +{ + assert(list); + assert(font); + + imutils::text_wr(list, text, pos, color, shadow, font, wrap, font->LegacySize); +} + +void imutils::text_wr(ImDrawList* list, std::string_view text, const ImVec2& pos, ImU32 color, ImU32 shadow, ImFont* font, float wrap, + float size) +{ + assert(list); + assert(font); + + auto shift = static_cast<float>(globals::gui_scale); + auto shadow_pos = ImVec2(pos.x + shift, pos.y + shift); + + list->AddText(font, size, shadow_pos, shadow, text.data(), text.data() + text.size(), wrap); + list->AddText(font, size, pos, color, text.data(), text.data() + text.size(), wrap); +} |
