mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-07-15 23:07:59 +08:00
refactor!: Modify command argument handling and move on_
method to bool_command (#1826)
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user