refactor!: Modify command argument handling and move on_ method to bool_command (#1826)

This commit is contained in:
Andreas Maerten
2023-07-26 22:22:40 +02:00
committed by GitHub
parent d590313e4e
commit 4b1fd88f6c
104 changed files with 562 additions and 381 deletions

View File

@ -20,7 +20,7 @@ namespace big
if (ImGui::Begin("cmd_executor", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoMouseInputs))
{
static char command_buffer[255];
static std::string command_buffer;
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {10.f, 15.f});
components::sub_title("CMD_EXECUTOR_TITLE"_T);
@ -28,13 +28,14 @@ namespace big
ImGui::SetKeyboardFocusHere(0);
ImGui::SetNextItemWidth((screen_x * 0.5f) - 30.f);
components::input_text_with_hint("", "CMD_EXECUTOR_TYPE_CMD"_T, command_buffer, sizeof(command_buffer), ImGuiInputTextFlags_EnterReturnsTrue, [] {
if (components::input_text_with_hint("", "CMD_EXECUTOR_TYPE_CMD"_T, command_buffer, ImGuiInputTextFlags_EnterReturnsTrue))
{
if (command::process(command_buffer, std::make_shared<default_command_context>(), true))
{
g.cmd_executor.enabled = false;
command_buffer[0] = 0;
command_buffer = {};
}
});
}
components::small_text("CMD_EXECUTOR_MULTIPLE_CMDS"_T);
ImGui::Spacing();