33 #include <fmt/format.h>
51 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0,0,0,0));
52 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0,0));
55 ImGuiWindowFlags msg_flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
56 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar;
58 ImVec2 msg_size(width, (ImGui::GetIO().DisplaySize.y / 3.f) + (2*ImGui::GetStyle().WindowPadding.y));
59 ImVec2 chat_size(width, ImGui::GetTextLineHeightWithSpacing() + 20);
63 msg_pos.y -= chat_size.y;
66 ImGui::SetNextWindowPos(msg_pos);
67 ImGui::SetNextWindowSize(msg_size);
71 ImGui::Begin(
"ChatMessages",
nullptr, msg_flags);
75 ImGui::Begin(
"ChatMessages",
nullptr, msg_flags | ImGuiWindowFlags_NoInputs);
98 ImGui::SetScrollFromPosY(9999);
128 ImGuiWindowFlags chat_flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
129 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
131 ImGui::SetNextWindowSize(chat_size);
133 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0,0.0,0,0));
134 ImGui::Begin(
"ChatBottomBar",
nullptr, chat_flags);
136 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
143 ImGui::Text(
"%s",
_LC(
"ChatBox",
"Chat history (use mouse wheel to scroll)"));
144 ImGui::Text(
"%s",
_LC(
"ChatBox",
"Message"));
148 ImGui::SetKeyboardFocusHere();
151 const ImGuiInputTextFlags cmd_flags = ImGuiInputTextFlags_EnterReturnsTrue;
165 ImGui::PopStyleColor(2);
166 ImGui::PopStyleVar();
179 const char* username = std::strtok(
nullptr,
" ");
180 const char* message = std::strtok(
nullptr,
" ");
181 if (username !=
nullptr && message !=
nullptr)
192 fmt::format(
_LC(
"ChatBox",
"Whisper message not sent, unknown username: {}"), username));
199 _LC(
"ChatBox",
"usage: /whisper username message"));
206 #endif // USE_SOCKETW