32 #include <fmt/format.h>
44 Ogre::String keys_pressed;
47 if (num_nonmodifier_keys > 0)
62 ImGui::SetNextWindowPosCenter();
63 ImGuiWindowFlags flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize;
65 ImGui::Begin(
_LC(
"GameControls",
"Press a new key"), &open, flags);
71 ImGui::Text(keys_pressed.c_str());
75 const bool checkbox_hovered = ImGui::IsItemHovered();
77 ImGui::TextDisabled(
"(?)");
78 const bool hint_hovered = ImGui::IsItemHovered();
79 if (checkbox_hovered || hint_hovered)
81 ImGui::BeginTooltip();
82 ImGui::Text(
"%s",
_LC(
"GameControls",
83 "With EXPL tag, only exactly matching key combos will be triggered.\n"
84 "Without it, partial matches will trigger, too."));
86 ImGui::Text(
"%s",
_LC(
"GameControls",
87 "Example: Pressing CTRL+F1 will trigger COMMANDS_03 and COMMANDS_01\n"
88 "but not COMMANDS_02 which has EXPL tag."));
89 ImGui::TextDisabled(
" COMMANDS_01 Keyboard F1");
90 ImGui::TextDisabled(
" COMMANDS_02 Keyboard EXPL+F1");
91 ImGui::TextDisabled(
" COMMANDS_03 Keyboard CTRL+F1");
105 ImGui::SetNextWindowPosCenter(ImGuiCond_FirstUseEver);
106 ImGui::SetNextWindowSize(ImVec2(800.f, 600.f), ImGuiCond_FirstUseEver);
107 bool keep_open =
true;
108 ImGui::Begin(
_LC(
"GameControls",
"Game Controls"), &keep_open);
116 if (ImGui::Button(
_LC(
"GameControls",
"Save changes")))
121 if (ImGui::Button(
_LC(
"GameControls",
"Reset changes")))
129 ImGui::BeginTabBar(
"GameSettingsTabs");
146 m_is_hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);
161 float cursor_x = ImGui::GetCursorPosX();
164 int display_count = 0;
169 if (display_count == 0)
175 ImGui::PushID((
int)ev_code);
184 int num_visible_commands = 0;
190 int num_drawn_commands = 0;
195 ImGui::PushID(&trig);
197 ImVec2 cursor_before_command = ImGui::GetCursorScreenPos();
199 if (ImGui::Button(
App::GetInputEngine()->getTriggerCommand(trig).c_str(), ImVec2(ImGui::GetColumnWidth() - 2*ImGui::GetStyle().ItemSpacing.x, 0)))
211 num_drawn_commands++;
212 if (num_visible_commands > 1)
214 ImVec2 text_pos = cursor_before_command + ImGui::GetStyle().FramePadding;
215 ImU32 text_color = ImColor(ImGui::GetStyle().Colors[ImGuiCol_TextDisabled]);
216 ImGui::GetWindowDrawList()->AddText(text_pos, text_color,
fmt::format(
"{}.", num_drawn_commands).c_str());
258 ImGui::SetItemDefaultFocus();
265 int flags = ImGuiInputTextFlags_EnterReturnsTrue;
268 flags |= ImGuiInputTextFlags_CharsNoBlank;
272 flags |= ImGuiInputTextFlags_CharsUppercase;
280 if (ImGui::Button(
_LC(
"GameSettings",
"OK")))
285 if (ImGui::Button(
_LC(
"GameSettings",
"Cancel")))
290 if (ImGui::Button(
_LC(
"GameSettings",
"Delete")))
299 ImGui::Columns(3,
nullptr,
true);
308 if (ev_name.find(prefix) == 0)
323 if (ImGui::BeginTabItem(
_LC(
"GameSettings", name)))
325 ImGui::PushID(prefix);
328 ImGui::Columns(3,
nullptr,
true);
329 ImGui::SetColumnWidth(0,
m_colum_widths[0] + ImGui::GetStyle().FramePadding.x + 1);
342 ImGui::BeginChild(
"scroll");
367 std::string format_string;
370 format_string =
"{} {} {}";
374 format_string =
"{} {} 0 {}";