mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-17 05:41:46 -04:00
Refactor network usage and adapt Sail/CC to changes
This commit is contained in:
@@ -814,4 +814,18 @@ namespace UIWidgets {
|
||||
float sz = ImGui::GetFrameHeight();
|
||||
return StateButtonEx(str_id, label, ImVec2(sz, sz), ImGuiButtonFlags_None);
|
||||
}
|
||||
|
||||
// Reference: imgui-src/misc/cpp/imgui_stdlib.cpp
|
||||
int InputTextResizeCallback(ImGuiInputTextCallbackData* data) {
|
||||
std::string* value = (std::string*)data->UserData;
|
||||
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) {
|
||||
value->resize(data->BufTextLen);
|
||||
data->Buf = (char*)value->c_str();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool InputString(const char* label, std::string* value) {
|
||||
return ImGui::InputText(label, (char*)value->c_str(), value->capacity() + 1, ImGuiInputTextFlags_CallbackResize, InputTextResizeCallback, value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user