mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-16 21:38:07 -04:00
Merge remote-tracking branch 'origin/develop' into develop->develop-rando
This commit is contained in:
@@ -24,7 +24,7 @@ namespace UIWidgets {
|
||||
// Automatically adds newlines to break up text longer than a specified number of characters
|
||||
// Manually included newlines will still be respected and reset the line length
|
||||
// If line is midword when it hits the limit, text should break at the last encountered space
|
||||
char* WrappedText(const char* text, unsigned int charactersPerLine) {
|
||||
std::string WrappedText(const char* text, unsigned int charactersPerLine) {
|
||||
std::string newText(text);
|
||||
const size_t tipLength = newText.length();
|
||||
int lastSpace = -1;
|
||||
@@ -46,17 +46,17 @@ namespace UIWidgets {
|
||||
currentLineLength++;
|
||||
}
|
||||
|
||||
return strdup(newText.c_str());
|
||||
return newText;
|
||||
}
|
||||
|
||||
char* WrappedText(const std::string& text, unsigned int charactersPerLine) {
|
||||
std::string WrappedText(const std::string& text, unsigned int charactersPerLine) {
|
||||
return WrappedText(text.c_str(), charactersPerLine);
|
||||
}
|
||||
|
||||
void SetLastItemHoverText(const std::string& text) {
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("%s", WrappedText(text, 60));
|
||||
ImGui::Text("%s", WrappedText(text, 60).c_str());
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace UIWidgets {
|
||||
void SetLastItemHoverText(const char* text) {
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("%s", WrappedText(text, 60));
|
||||
ImGui::Text("%s", WrappedText(text, 60).c_str());
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace UIWidgets {
|
||||
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "?");
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("%s", WrappedText(text, 60));
|
||||
ImGui::Text("%s", WrappedText(text, 60).c_str());
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace UIWidgets {
|
||||
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "?");
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("%s", WrappedText(text, 60));
|
||||
ImGui::Text("%s", WrappedText(text, 60).c_str());
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace UIWidgets {
|
||||
|
||||
void Tooltip(const char* text) {
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip("%s", WrappedText(text));
|
||||
ImGui::SetTooltip("%s", WrappedText(text).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user