27 #include <fmt/format.h>
86 ImGui::PushStyleColor(ImGuiCol_TitleBg, ImGui::GetStyle().Colors[ImGuiCol_TitleBgActive]);
91 ImVec2 display_size = ImGui::GetIO().DisplaySize;
92 if ((display_size.x > 2200.f) && (display_size.y < 1100.f))
94 ImGui::SetNextWindowPosCenter();
98 const float btn_height = ImGui::GetTextLineHeight() + (
BUTTON_PADDING.y * 2);
99 const float window_height = (
m_num_buttons*btn_height) + (
m_num_buttons*ImGui::GetStyle().ItemSpacing.y) + (2*ImGui::GetStyle().WindowPadding.y);
100 const float margin = display_size.y / 15.f;
101 const float top = display_size.y - window_height - margin;
102 ImGui::SetNextWindowPos(ImVec2(margin, top));
105 int flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize;
106 if (ImGui::Begin(
_LC(
"MainMenu",
title),
nullptr,
static_cast<ImGuiWindowFlags_
>(flags)))
110 int button_index = 0;
209 ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
222 ImGui::PopStyleVar();
223 ImGui::PopStyleColor(3);
229 const float margin = ImGui::GetIO().DisplaySize.y / 30.f;
232 float text_w = std::max(
233 ImGui::CalcTextSize(game_ver.c_str()).x, ImGui::CalcTextSize(rornet_ver.c_str()).x);
235 (2 * ImGui::GetStyle().WindowPadding.y) + text_w,
236 (2 * ImGui::GetStyle().WindowPadding.y) + (2 * ImGui::GetTextLineHeight()));
237 ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize - (box_size + ImVec2(margin, margin)));
240 ImGuiWindowFlags flags =
241 ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize |
242 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar |
243 ImGuiWindowFlags_NoInputs;
244 if (ImGui::Begin(
_LC(
"MainMenu",
"Version box"),
nullptr, flags))
246 ImGui::Text(
"%s", game_ver.c_str());
247 ImGui::Text(
"%s", rornet_ver.c_str());
250 ImGui::PopStyleColor(1);
255 Ogre::TexturePtr tex =
FetchIcon(
"accept.png");
257 const float margin = ImGui::GetIO().DisplaySize.y / 30.f;
260 std::string cache_ntc =
fmt::format(
"{}",
_LC(
"MainMenu",
"Cache updated"));
261 float text_w = std::max(
262 ImGui::CalcTextSize(game_ver.c_str()).x, ImGui::CalcTextSize(rornet_ver.c_str()).x);
264 (2 * ImGui::GetStyle().WindowPadding.y) + text_w,
265 (2 * ImGui::GetStyle().WindowPadding.y) + (4.5 * ImGui::GetTextLineHeight()));
266 ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize - (box_size + ImVec2(margin, margin)));
269 ImGuiWindowFlags flags =
270 ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize |
271 ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar |
272 ImGuiWindowFlags_NoInputs;
273 if (ImGui::Begin(
_LC(
"MainMenu",
"Notice box"),
nullptr, flags))
275 ImGui::Image(
reinterpret_cast<ImTextureID
>(tex->getHandle()), ImVec2(16, 16));
277 ImGui::Text(
"%s", cache_ntc.c_str());
280 ImGui::PopStyleColor(1);
285 return ImGui::Button(button_txt.c_str(), btn_size) || (
m_kb_enter_index == index);
292 bool window_hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);
293 if (!kb_capture_req || window_hovered)
296 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)))
300 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)))
304 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)))