118 std::string repolist_url = portal_url +
"/resource-categories";
119 std::string response_payload;
120 std::string response_header;
121 long response_code = 0;
122 std::string user_agent = fmt::format(
"{}/{}",
"Rigs of Rods Client",
ROR_VERSION_STRING);
126 CURL *curl = curl_easy_init();
127 curl_easy_setopt(curl, CURLOPT_URL, repolist_url.c_str());
128 curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
130 curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
132 curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING,
"gzip");
133 curl_easy_setopt(curl, CURLOPT_USERAGENT, user_agent.c_str());
134 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
CurlWriteFunc);
135 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response_payload);
136 curl_easy_setopt(curl, CURLOPT_HEADERDATA, &response_header);
138 CURLcode curl_result = curl_easy_perform(curl);
139 curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
141 curl_easy_cleanup(curl);
144 std::vector<GUI::ResourceCategories> cat;
145 if (curl_result != CURLE_OK || response_code != 200)
147 Ogre::LogManager::getSingleton().stream()
148 <<
"[RoR|Repository] Failed to retrieve category list;"
149 <<
" Error: '" << curl_easy_strerror(curl_result) <<
"'; HTTP status code: " << response_code;
153 rapidjson::Document j_data_doc;
154 j_data_doc.Parse(response_payload.c_str());
156 rapidjson::Value& j_resp_body = j_data_doc[
"categories"];
157 size_t num_rows = j_resp_body.GetArray().Size();
158 cat.resize(num_rows);
159 for (
size_t i = 0; i < num_rows; i++)
161 rapidjson::Value& j_row = j_resp_body[
static_cast<rapidjson::SizeType
>(i)];
163 cat[i].title = j_row[
"title"].GetString();
164 cat[i].resource_category_id = j_row[
"resource_category_id"].GetInt();
165 cat[i].resource_count = j_row[
"resource_count"].GetInt();
166 cat[i].description = j_row[
"description"].GetString();
167 cat[i].display_order = j_row[
"display_order"].GetInt();
175 std::string repolist_url = portal_url +
"/resources";
176 std::string response_payload;
177 std::string response_header;
178 long response_code = 0;
179 std::string user_agent = fmt::format(
"{}/{}",
"Rigs of Rods Client",
ROR_VERSION_STRING);
181 CURL *curl = curl_easy_init();
182 curl_easy_setopt(curl, CURLOPT_URL, repolist_url.c_str());
183 curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
185 curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);
187 curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING,
"gzip");
188 curl_easy_setopt(curl, CURLOPT_USERAGENT, user_agent.c_str());
189 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
CurlWriteFunc);
190 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response_payload);
191 curl_easy_setopt(curl, CURLOPT_HEADERDATA, &response_header);
193 CURLcode curl_result = curl_easy_perform(curl);
194 curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
196 curl_easy_cleanup(curl);
199 if (curl_result != CURLE_OK || response_code != 200)
201 Ogre::LogManager::getSingleton().stream()
202 <<
"[RoR|Repository] Failed to retrieve repolist;"
203 <<
" Error: '"<< curl_easy_strerror(curl_result) <<
"'; HTTP status code: " << response_code;
206 failinfo->
title =
_LC(
"RepositorySelector",
"Could not connect to server. Please check your connection.");
215 rapidjson::Document j_data_doc;
216 j_data_doc.Parse(response_payload.c_str());
217 if (j_data_doc.HasParseError() || !j_data_doc.IsObject())
219 Ogre::LogManager::getSingleton().stream()
220 <<
"[RoR|Repository] Error parsing repolist JSON, code: " << j_data_doc.GetParseError();
228 std::vector<GUI::ResourceItem> resc;
229 rapidjson::Value& j_resp_body = j_data_doc[
"resources"];
230 size_t num_rows = j_resp_body.GetArray().Size();
231 resc.resize(num_rows);
233 for (
size_t i = 0; i < num_rows; i++)
235 rapidjson::Value& j_row = j_resp_body[
static_cast<rapidjson::SizeType
>(i)];
237 resc[i].title = j_row[
"title"].GetString();
238 resc[i].tag_line = j_row[
"tag_line"].GetString();
239 resc[i].resource_id = j_row[
"resource_id"].GetInt();
240 resc[i].download_count = j_row[
"download_count"].GetInt();
241 resc[i].last_update = j_row[
"last_update"].GetInt();
242 resc[i].resource_category_id = j_row[
"resource_category_id"].GetInt();
243 resc[i].icon_url = j_row[
"icon_url"].GetString();
244 resc[i].rating_avg = j_row[
"rating_avg"].GetFloat();
245 resc[i].rating_count = j_row[
"rating_count"].GetInt();
246 resc[i].version = j_row[
"version"].GetString();
247 resc[i].authors = j_row[
"custom_fields"][
"authors"].GetString();
248 resc[i].view_url = j_row[
"view_url"].GetString();
249 resc[i].resource_date = j_row[
"resource_date"].GetInt();
250 resc[i].view_count = j_row[
"view_count"].GetInt();
251 resc[i].preview_tex = Ogre::TexturePtr();
255 cdata_ptr->
items = resc;
401 ImGui::SetNextWindowSize(ImVec2((ImGui::GetIO().DisplaySize.x / 1.4), (ImGui::GetIO().DisplaySize.y / 1.2)), ImGuiCond_FirstUseEver);
402 ImGui::SetNextWindowPosCenter(ImGuiCond_Appearing);
403 ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
404 bool keep_open =
true;
405 Ogre::TexturePtr tex1 =
FetchIcon(
"arrow_rotate_anticlockwise.png");
406 Ogre::TexturePtr tex2 =
FetchIcon(
"accept.png");
407 Ogre::TexturePtr tex3 =
FetchIcon(
"star.png");
408 Ogre::TexturePtr tex4 =
FetchIcon(
"arrow_left.png");
410 ImGui::Begin(
_LC(
"RepositorySelector",
"Rigs of Rods Repository"), &keep_open, window_flags);
413 && ImGui::ImageButton(
reinterpret_cast<ImTextureID
>(tex4->getHandle()), ImVec2(16, 16)))
425 && ImGui::ImageButton(
reinterpret_cast<ImTextureID
>(tex1->getHandle()), ImVec2(16, 16)))
436 ImGui::PushItemFlag(ImGuiItemFlags_Disabled,
true);
437 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
441 ImGui::SetNextItemWidth(ImGui::GetWindowSize().
x
445 - 6*ImGui::GetStyle().ItemSpacing.x
446 - 2*ImGui::GetStyle().WindowPadding.x);
493 ImGui::SetItemDefaultFocus();
501 float searchbox_x = ImGui::GetCursorPosX();
502 ImGui::SetNextItemWidth(170);
503 float search_pos = ImGui::GetCursorPosX();
508 ImGui::SetNextItemWidth(80);
510 if (ImGui::BeginCombo(
"##repo-selector-sort",
_LC(
"RepositorySelector",
"Sort")))
512 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"Last Update"),
m_current_sort ==
"Last Update"))
517 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"Date Added"),
m_current_sort ==
"Date Added"))
522 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"Title"),
m_current_sort ==
"Title"))
527 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"Downloads"),
m_current_sort ==
"Downloads"))
532 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"Rating"),
m_current_sort ==
"Rating"))
537 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"Rating Count"),
m_current_sort ==
"Rating Count"))
547 ImGui::SetNextItemWidth(80);
549 if (ImGui::BeginCombo(
"##repo-selector-view",
_LC(
"RepositorySelector",
"View")))
551 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"List"),
m_view_mode ==
"List"))
555 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"Compact"),
m_view_mode ==
"Compact"))
559 if (ImGui::Selectable(
_LC(
"RepositorySelector",
"Basic"),
m_view_mode ==
"Basic"))
570 ImGui::SetCursorPosX(search_pos + ImGui::GetStyle().ItemSpacing.x);
571 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Search Title, Author"));
576 ImGui::PopItemFlag();
577 ImGui::PopStyleVar();
580 const float table_height = ImGui::GetWindowHeight()
581 - ((2.f * ImGui::GetStyle().WindowPadding.y) + (3.f * ImGui::GetItemsLineHeightWithSpacing())
582 - ImGui::GetStyle().ItemSpacing.y);
600 float col0_width = 0.40f * ImGui::GetWindowContentRegionWidth();
601 float col1_width = 0.15f * ImGui::GetWindowContentRegionWidth();
602 float col2_width = 0.20f * ImGui::GetWindowContentRegionWidth();
603 float col3_width = 0.10f * ImGui::GetWindowContentRegionWidth();
607 ImGui::Columns(5,
"repo-selector-columns-basic-headers",
false);
608 ImGui::SetColumnWidth(0, col0_width + ImGui::GetStyle().ItemSpacing.x);
609 ImGui::SetColumnWidth(1, col1_width);
610 ImGui::SetColumnWidth(2, col2_width);
611 ImGui::SetColumnWidth(3, col3_width);
613 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Title"));
615 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Version"));
617 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Last Update"));
619 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Downloads"));
621 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Rating"));
626 ImGui::BeginChild(
"scrolling", ImVec2(0.f, table_height),
false);
630 ImGui::Columns(2,
"repo-selector-columns");
631 ImGui::SetColumnWidth(0, 100.f);
636 ImGui::Columns(5,
"repo-selector-columns-basic");
637 ImGui::SetColumnWidth(0, col0_width);
638 ImGui::SetColumnWidth(1, col1_width);
639 ImGui::SetColumnWidth(2, col2_width);
640 ImGui::SetColumnWidth(3, col3_width);
645 int num_drawn_items = 0;
658 for (
auto& c : title)
663 for (
auto& c : author)
668 for (
auto& c : search)
672 if (title.find(search) == std::string::npos && author.find(search) == std::string::npos)
682 ImGui::SetCursorPosX(ImGui::GetCursorPosX() - ImGui::GetStyle().ItemSpacing.x);
683 const ImVec2 thumb_size = ImVec2(ImGui::GetColumnWidth() - ImGui::GetStyle().ItemSpacing.x, 96);
684 const float spinner_size = ImGui::GetColumnWidth() / 4;
685 const float spinner_cursor_x(((ImGui::GetColumnWidth() - ImGui::GetStyle().ItemSpacing.x) / 2.f) - spinner_size);
686 const float spinner_cursor_y(ImGui::GetCursorPosY() + 5 * ImGui::GetStyle().ItemSpacing.y);
687 this->
DrawThumbnail(i, thumb_size, spinner_size, ImVec2(spinner_cursor_x, spinner_cursor_y));
689 float width = (ImGui::GetColumnWidth() + 90);
693 ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.17f, 0.17f, 0.17f, 0.90f));
694 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImGui::GetStyle().Colors[ImGuiCol_Header]);
695 ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.22f, 0.22f, 0.22f, 0.90f));
698 float orig_cursor_y = ImGui::GetCursorPosY();
699 std::string item_id =
"##" + std::to_string(i);
701 if (ImGui::Selectable(item_id.c_str(),
false, 0, ImVec2(0, 100)))
707 ImGui::SetCursorPosY(orig_cursor_y);
708 ImGui::PopStyleColor(3);
713 ImGui::TextDisabled(
"%s",
m_data.
items[i].version.c_str());
716 for (
int i = 1; i <= 5; i++)
719 ImGui::SetCursorPosX(ImGui::GetColumnWidth() + 16 * i);
720 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex3->getHandle()), ImVec2(16, 16), ImVec2(0.f, 0.f), ImVec2(1.f, 1.f), ImVec4(1.f, 1.f, 1.f, 0.2f));
724 for (
int i = 1; i <= rating; i++)
727 ImGui::SetCursorPosX(ImGui::GetColumnWidth() + 16 * i);
728 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex3->getHandle()), ImVec2(16, 16));
732 ImGui::TextDisabled(
"%s:",
_LC(
"RepositorySelector",
"Authors"));
734 ImGui::SetCursorPosX(width);
738 std::string rc = std::to_string(
m_data.
items[i].rating_count) +
" ratings";
739 ImGui::SetCursorPosX(ImGui::GetColumnWidth() - (ImGui::CalcTextSize(rc.c_str()).x / 2) + 16 * 3.5);
740 ImGui::TextDisabled(
"%s", rc.c_str());
742 ImGui::TextDisabled(
"%s:",
_LC(
"RepositorySelector",
"Last Update"));
744 ImGui::SetCursorPosX(width);
745 time_t rawtime = (
const time_t)
m_data.
items[i].last_update;
748 ImGui::TextDisabled(
"%s:",
_LC(
"RepositorySelector",
"Downloads"));
750 ImGui::SetCursorPosX(width);
753 ImGui::TextDisabled(
"%s:",
_LC(
"RepositorySelector",
"Description"));
755 ImGui::SetCursorPosX(width);
764 float orig_cursor_x = ImGui::GetCursorPos().x;
767 float box_width = (ImGui::GetIO().DisplaySize.x / 1.4) / 3;
768 if (ImGui::GetIO().DisplaySize.x <= 1280)
770 box_width = (ImGui::GetIO().DisplaySize.x / 1.4) / 2;
774 if (orig_cursor_x > ImGui::GetWindowContentRegionMax().x - (box_width * 0.5))
777 if (num_drawn_items != 0)
785 ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.70f, 0.70f, 0.70f, 0.90f));
786 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImGui::GetStyle().Colors[ImGuiCol_Header]);
787 ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.90f, 0.90f, 0.90f, 0.90f));
790 float orig_cursor_y = ImGui::GetCursorPosY();
791 std::string item_id =
"##" + std::to_string(i);
793 if (ImGui::Selectable(item_id.c_str(),
false, 0, ImVec2(box_width - ImGui::GetStyle().ItemSpacing.x, 100)))
800 ImVec2 p_min = ImGui::GetItemRectMin();
801 ImVec2 p_max = ImGui::GetItemRectMax();
802 ImGui::GetWindowDrawList()->AddRectFilled(p_min, p_max, ImColor(ImVec4(0.15f, 0.15f, 0.15f, 0.90f)));
804 ImGui::SetCursorPosY(orig_cursor_y);
805 ImGui::PopStyleColor(3);
808 const ImVec2 thumbnail_size(76, 86);
809 const float spinner_size = 25;
810 const float spinner_cursor_x(ImGui::GetCursorPosX() + 2 * ImGui::GetStyle().ItemSpacing.x);
811 const float spinner_cursor_y(ImGui::GetCursorPosY() + 20);
812 this->
DrawThumbnail(i, thumbnail_size, spinner_size, ImVec2(spinner_cursor_x, spinner_cursor_y));
815 ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 76 - (35 + spinner_size));
820 for (
int i = 1; i <= 5; i++)
822 pos_y = ImGui::GetCursorPosY();
823 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex3->getHandle()), ImVec2(11, 11), ImVec2(0.f, 0.f), ImVec2(1.f, 1.f), ImVec4(1.f, 1.f, 1.f, 0.2f));
824 if (i < 5) { ImGui::SameLine(); }
830 for (
int i = 1; i <= rating; i++)
832 ImGui::SetCursorPosY(pos_y);
833 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex3->getHandle()), ImVec2(11, 11));
834 if (i < rating) { ImGui::SameLine(); }
839 ImGui::SetCursorPosX(ImGui::GetCursorPos().
x + 86);
840 ImGui::SetCursorPosY(ImGui::GetCursorPos().
y - 100);
844 if (ImGui::CalcTextSize(tl.c_str()).x > box_width / 12)
846 tl.resize(box_width / 12);
851 ImGui::Text(
"%s", tl.c_str());
853 ImGui::SetCursorPosX(ImGui::GetCursorPos().
x + 86);
856 ImGui::SetCursorPosX(ImGui::GetCursorPos().
x + 86);
857 time_t rawtime = (
const time_t)
m_data.
items[i].last_update;
860 ImGui::SetCursorPosX(ImGui::GetCursorPos().
x + 86);
864 ImGui::SetCursorPosX(ImGui::GetCursorPos().
x + box_width);
865 ImGui::SetCursorPosY(ImGui::GetCursorPos().
y + (1.5f * ImGui::GetStyle().WindowPadding.y));
873 ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.18f, 0.18f, 0.18f, 0.90f));
874 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImGui::GetStyle().Colors[ImGuiCol_Header]);
875 ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.22f, 0.22f, 0.22f, 0.90f));
878 std::string item_id =
"##" + std::to_string(i);
880 if (ImGui::Selectable(item_id.c_str(),
false, ImGuiSelectableFlags_SpanAllColumns))
886 ImGui::PopStyleColor(3);
890 ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 2 * ImGui::GetStyle().ItemSpacing.x);
899 time_t rawtime = (
const time_t)
m_data.
items[i].last_update;
908 float pos_x = ImGui::GetCursorPosX();
911 for (
int i = 1; i <= 5; i++)
913 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex3->getHandle()), ImVec2(16, 16), ImVec2(0.f, 0.f), ImVec2(1.f, 1.f), ImVec4(1.f, 1.f, 1.f, 0.2f));
914 ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 16 * i);
917 ImGui::SetCursorPosX(pos_x);
920 for (
int i = 1; i <= rating; i++)
922 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex3->getHandle()), ImVec2(16, 16));
923 ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 16 * i);
943 float spinner_size = 27.f;
944 ImGui::SetCursorPosX((ImGui::GetWindowSize().
x / 2.f) - spinner_size);
945 ImGui::SetCursorPosY((ImGui::GetWindowSize().
y / 2.f) - spinner_size);
951 const ImVec2 label_size = ImGui::CalcTextSize(
m_repolist_msg.c_str());
952 float y = (ImGui::GetWindowSize().y / 2.f) - (ImGui::GetTextLineHeight() / 2.f);
953 ImGui::SetCursorPosX((ImGui::GetWindowSize().
x / 2.f) - (label_size.x / 2.f));
954 ImGui::SetCursorPosY(
y);
956 y += ImGui::GetTextLineHeightWithSpacing();
961 ImGui::SetCursorPosX((ImGui::GetWindowSize().
x / 2.f) - (detail_size.x / 2.f));
962 ImGui::SetCursorPosY(
y);
964 y += ImGui::GetTextLineHeight();
970 ImGui::SetCursorPosX((ImGui::GetWindowSize().
x / 2.f) - (detail_size.x / 2.f));
971 ImGui::SetCursorPosY(
y);
1044 Ogre::TexturePtr tex2 =
FetchIcon(
"accept.png");
1045 Ogre::TexturePtr tex3 =
FetchIcon(
"star.png");
1046 Ogre::TexturePtr tex4 =
FetchIcon(
"arrow_left.png");
1049 const float INFOBAR_HEIGHT = 100.f;
1050 const float INFOBAR_SPACING_LEFTSIDE = 2.f;
1055 ImVec2 leftmost_cursor = ImGui::GetCursorPos();
1056 float left_pane_width = searchbox_x - (leftmost_cursor.x + ImGui::GetStyle().ItemSpacing.x);
1057 ImVec2 backdrop_size = ImVec2(left_pane_width, INFOBAR_HEIGHT + ImGui::GetStyle().WindowPadding.y * 2);
1058 ImGui::GetWindowDrawList()->AddRectFilled(ImGui::GetCursorScreenPos(), ImGui::GetCursorScreenPos() + backdrop_size, ImColor(0.f, 0.f, 0.f, 0.5f), 5.f);
1059 ImGui::SetCursorPos(ImGui::GetCursorPos() + ImGui::GetStyle().WindowPadding);
1062 ImVec2 thumbnail_cursor = ImGui::GetCursorPos();
1063 const float spinner_size = INFOBAR_HEIGHT / 4;
1064 const ImVec2 spinner_cursor = thumbnail_cursor + ImVec2(INFOBAR_HEIGHT/5, INFOBAR_HEIGHT/5);
1069 ImVec2 newline_cursor = thumbnail_cursor + ImVec2(INFOBAR_HEIGHT + ImGui::GetStyle().WindowPadding.x*2, 0.f);
1070 ImGui::SetCursorPos(newline_cursor);
1075 std::string browser_text =
_LC(
"RepositorySelector",
"View in web browser");
1076 ImGui::SetCursorPosX(searchbox_x - (ImGui::CalcTextSize(browser_text.c_str()).x + ImGui::GetStyle().ItemSpacing.x + ImGui::GetStyle().WindowPadding.x));
1080 newline_cursor += ImVec2(0.f, ImGui::GetTextLineHeight() + INFOBAR_SPACING_LEFTSIDE);
1081 ImGui::SetCursorPos(newline_cursor);
1082 const ImVec2 tagline_btnsize = ImGui::CalcTextSize(
"[...]") + ImGui::GetStyle().ItemSpacing * 2;
1083 const ImVec2 tagline_size = ImGui::CalcTextSize(selected_item.
tag_line.c_str());
1084 const ImVec2 tagline_clipmin = ImGui::GetCursorScreenPos();
1085 const ImVec2 tagline_clipmax((ImGui::GetWindowPos().
x + searchbox_x) - (tagline_btnsize.x + ImGui::GetStyle().FramePadding.x), tagline_clipmin.y + ImGui::GetTextLineHeight());
1086 ImGui::PushClipRect(tagline_clipmin, tagline_clipmax,
false);
1087 ImGui::Text(
"%s", selected_item.
tag_line.c_str());
1088 ImGui::PopClipRect();
1089 if (tagline_size.x > tagline_clipmax.x - tagline_clipmin.x)
1092 ImGui::SetCursorPos(ImVec2(searchbox_x - (tagline_btnsize.x + ImGui::GetStyle().FramePadding.x), newline_cursor.y));
1093 ImGui::TextDisabled(
"[...]");
1094 if (ImGui::IsItemHovered())
1096 ImGui::BeginTooltip();
1097 ImGui::Text(
"%s", selected_item.
tag_line.c_str());
1098 ImGui::EndTooltip();
1103 newline_cursor += ImVec2(0.f, ImGui::GetTextLineHeight() + INFOBAR_SPACING_LEFTSIDE * 4);
1104 ImGui::SetCursorPos(newline_cursor);
1105 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Version:"));
1109 ImGui::TextDisabled(
"(%s",
_LC(
"RepositorySelector",
"Downloads:"));
1113 ImGui::SetCursorPosX(ImGui::GetCursorPosX() - ImGui::GetStyle().ItemSpacing.x);
1114 ImGui::TextDisabled(
")");
1117 newline_cursor += ImVec2(0.f, ImGui::GetTextLineHeight() + INFOBAR_SPACING_LEFTSIDE);
1118 ImGui::SetCursorPos(newline_cursor);
1119 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Rating:"));
1124 ImVec2 stars_cursor = ImGui::GetCursorPos();
1125 int rating = round(selected_item.
rating_avg);
1126 for (
int i = 1; i <= 5; i++)
1128 ImGui::SetCursorPosX(stars_cursor.x + 16 * (i-1));
1129 ImVec4 tint_color = (i <= rating) ? ImVec4(1, 1, 1, 1) : ImVec4(1.f, 1.f, 1.f, 0.2f);
1130 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex3->getHandle()), ImVec2(16, 16), ImVec2(0.f, 0.f), ImVec2(1.f, 1.f), tint_color);
1133 ImGui::SetCursorPosX(stars_cursor.x + 16 * 5 + ImGui::GetStyle().ItemSpacing.x);
1134 ImGui::TextDisabled(
"(%s",
_LC(
"RepositorySelector",
"Rating Count:"));
1138 ImGui::SetCursorPosX(ImGui::GetCursorPosX() - ImGui::GetStyle().ItemSpacing.x);
1139 ImGui::TextDisabled(
")");
1142 newline_cursor += ImVec2(0.f, ImGui::GetTextLineHeight() + INFOBAR_SPACING_LEFTSIDE);
1143 ImGui::SetCursorPos(newline_cursor);
1144 ImGui::TextDisabled(
"%s",
_LC(
"RepositorySelector",
"Authors:"));
1150 ImGui::SetCursorPos(ImVec2(searchbox_x, leftmost_cursor.y));
1154 ImGui::SetCursorPos(leftmost_cursor + ImVec2(0.f, backdrop_size.y + ImGui::GetStyle().ItemSpacing.y));
1155 const float table_height = ImGui::GetWindowHeight()
1156 - ((2.f * ImGui::GetStyle().WindowPadding.y) + (3.f * ImGui::GetItemsLineHeightWithSpacing() + backdrop_size.y + ImGui::GetStyle().ItemSpacing.y));
1161 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f, 0.f, 0.f, 0.f));
1162 const ImVec2 child_screenpos = ImGui::GetCursorScreenPos();
1163 const ImVec2 child_size(left_pane_width, table_height);
1164 ImGui::BeginChild(
"resource-view-scrolling", child_size,
true);
1165 ImGui::PopStyleColor();
1175 float spinner_radius = 25.f;
1176 ImGui::SetCursorPos(ImGui::GetCursorPos() + ImVec2(ImGui::GetContentRegionAvailWidth() / 2 - spinner_radius, 200.f));