53 std::string last_prefix;
64 last_prefix = m.cm_text.substr(0, m.cm_text.find(
" "));
69 ImDrawList* drawlist = ImGui::GetWindowDrawList();
70 drawlist->ChannelsSplit(2);
75 ImVec2 cursor = ImGui::GetWindowPos() + ImVec2(0, ImGui::GetWindowHeight());
80 cursor -= ImVec2(0, msg_h);
81 if (cursor.y < ImGui::GetWindowPos().y)
93 ImGui::SetCursorPosY(dummy_h);
96 if (num_incoming != 0 && std::abs(ImGui::GetScrollMaxY() - ImGui::GetScrollY()) < line_h)
99 ImGui::SetScrollY(ImGui::GetScrollMaxY() + (num_incoming * line_h) + 100.f);
103 float view_height = ImGui::GetWindowHeight();
104 if (ImGui::GetScrollMaxX() > 0)
106 view_height -= ImGui::GetStyle().ScrollbarSize;
110 int msg_start = 0, msg_count = 0;
111 ImVec2 cursor = ImGui::GetWindowPos();
112 if (ImGui::GetScrollMaxY() == 0)
115 cursor += ImVec2(0, view_height - (msg_count * line_h));
119 const float scroll_rel = ImGui::GetScrollY()/ImGui::GetScrollMaxY();
120 const float scroll_offset = ((dummy_h - view_height) * scroll_rel);
121 msg_start = std::max(0, (
int)(scroll_offset/line_h));
123 msg_count = std::min((
int)(view_height / line_h)+2,
126 const float line_offset = scroll_offset/line_h;
129 cursor -= ImVec2(0, (line_offset - (
float)(
int)line_offset)*line_h);
134 if (ImGui::GetScrollMaxX() > 0)
136 cursor -= ImVec2(ImGui::GetScrollX(), 0);
140 for (
int i = msg_start; i < msg_start + msg_count; i++)
145 ImGui::SetCursorPosX(text_size.x);
147 cursor += ImVec2(0.f, line_h);
152 drawlist->ChannelsMerge();
173 Ogre::TexturePtr icon;
180 icon = Ogre::TextureManager::getSingleton().load(m.
cm_icon,
"IconsRG");
186 icon = Ogre::TextureManager::getSingleton().load(
"script.png",
"IconsRG");
190 icon = Ogre::TextureManager::getSingleton().load(
"information.png",
"IconsRG");
194 icon = Ogre::TextureManager::getSingleton().load(
"error.png",
"IconsRG");
198 icon = Ogre::TextureManager::getSingleton().load(
"cancel.png",
"IconsRG");
202 icon = Ogre::TextureManager::getSingleton().load(
"comment.png",
"IconsRG");
216 color2i(ImVec4(col.r, col.g, col.b, col.a), r,g,b);
217 line << fmt::format(
"#{:02x}{:02x}{:02x}{}: #000000{}", r, g, b, user.
username, m.
cm_text);
233 ImVec4 base_color = ImGui::GetStyle().Colors[ImGuiCol_Text];
287 ImDrawList* drawlist = ImGui::GetWindowDrawList();
290 drawlist->ChannelsSetCurrent(1);
292 ImVec2 indent_size(0,0);
293 float text_h = ImGui::CalcTextSize(
"").y;
296 ImVec2 icon_size(icon->getWidth(), icon->getHeight());
297 ImVec2 tl = ImVec2(text_cursor.x, text_cursor.y + (text_h / 2) - (icon_size.y / 2));
298 ImVec2 br = tl + icon_size;
299 drawlist->AddImage(
reinterpret_cast<ImTextureID
>(icon->getHandle()), tl, br, ImVec2(0,0), ImVec2(1,1), ImColor(ImVec4(1,1,1,
alpha)));
300 const float ICON_GAP = 8;
301 indent_size = ImVec2(icon_size.x + ICON_GAP, text_h);
302 text_cursor.x += indent_size.x;
307 const ImVec2 total_text_size(indent_size.x + text_size.x, std::max(indent_size.y, text_size.y));
310 drawlist->ChannelsSetCurrent(0);
312 drawlist->AddRectFilled(bg_cursor, bg_cursor + bg_rect_size,
313 ImColor(ImVec4(0,0,0,(
alpha / 2))), ImGui::GetStyle().FrameRounding);
ImVec2 DrawColorMarkedText(ImDrawList *drawlist, ImVec2 text_cursor, ImVec4 default_color, float override_alpha, float wrap_width, std::string const &line)
Draw multiline text with '#rrggbb' color markers. Returns total text size.